Forum Xamarin Xamarin.Android

Android FirebaseMessaging When App Closed

XamarinMiamiBeachXamarinMiamiBeach USMember
edited December 2018 in Xamarin.Android

I have subclassed FirebaseMessagingService and when my Android app is "STOPPED", Android restarts an instance of Firebase IID as expected and listens for broadcasts/ push notifications!


Info (1443) / ActivityManager: Killing (adj 900): remove task
Debug (1443) / ActivityManager: cleanUpApplicationRecord -- 5117
Info (1443) / ActivityManager: Start proc for broadcast

This is great.

It appears that Firebase IID starts FirebaseMessaging when a remote notification is received (and yes, this is working when the app is in the STOPPED state). But, the FirebaseMessaging instance appears to be started by Android, isolated from all of my app library code. If I try to access the library code, I get a null reference exception and Android will shutdown Firebase IID. I was forced to move a required class into the FirebaseMessaging class as a child class in order to call instance methods from that class. And this does work. But I'm cloning code to make this work ( this code is shared by IOS and Android)

Is there a way to give permissions to the FirebaseMessaging subclass so that it can access my library code?


Sign In or Register to comment.