Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

MUST call Xamarin.Forms.Init() error in Boot broadcast receiver

$
0
0

Hello.
I'm working on a Xamarin.Forms PCL Android project and am trying to restore alarms after boot-up by reading from a database and creating alarms (via AlarmManager).

I have a broadcast receiver set to run when the boot up is completed (android.intent.action.BOOT_COMPLETED).

That part works fine. The problem is I am trying to access the local SQLite database that is defined in the "Core" project as a static member.

In the OnReceive event I attempt to read from the database but I get the exception "You MUST first call Xamarin.Forms.Init(); prior to using it.

Problem is "Init()" requires an Activity and a Bundle. I have neither at this point in the broadcast receiver.

I'm a little confused. Any suggestions are appreciated.

Thanks in advance,
Mike


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>