Forum Xamarin.Android

Statically registering a Broadcast Receiver in the AndroidManifest.xml does not work

I have been suffering over this for days.

I have written an app of which employs programmatic registered and a statically assigned Broadcast Receivers (MyBroadcastReceiver and MySecondBroadcastReceiver respectively). For the life of me I cannot provoke my statically registered Broadcast Receiver to acknowledge my custom Intent ("MY_SPECIFIC_ACTION"). My programmatically registered receiver is working just fine.

From what I have read, what I need is a statically defined Broadcast Receiver (statically meaning the receiver is defined in the AndroidManifest.xml file). Since I am coding a prototype using Xamarin.Android the proper way to mark the receiver is to decorate its class with [BroadcastReceiver(Enabled = true)] and [IntentFilter(new[] { "broadcast_example.MySecondBroadcastReceiver" })]. Upon compile time this markup will be added to the AndroidManifest. Although, I have tried statically registering the second Broadcast Receiver both ways.

I have tried this with Android 9.0 (Pie) and Android 7.0 (Nougat) having the same results as described above. I have seen a few samples online of statically registered Broadcast Receivers and claims that this works.

This is literately driving me crazy. I have attached my ZIPped solution to this post.

What exactly am I missing here?

Thanks,
Don

Sign In or Register to comment.