Forum Xamarin.Forms

Sticky service with DependencyService in code that is called

gfreeman19gfreeman19 Member ✭✭

I have an Android Foreground Service that monitors users' location. It is a sticky service. It calls into shared code, which has a logger that is loaded using DependencyService.

Everything runs fine until I test the sticky service and kill off my process. When my foreground service automatically restarts, I now get an exception because Forms.Init() hasn't been called, and the shared code references dependency service which requires Forms.Init().

Is there another way to load platform specific code in a shared library without referencing dependency services?


Sign In or Register to comment.