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!

DeviceLogs:

Info (1443) / ActivityManager: Killing 5117:com.my.app/u0a198 (adj 900): remove task
Debug (1443) / ActivityManager: cleanUpApplicationRecord -- 5117
Info (1443) / ActivityManager: Start proc 5311:com.my.app/u0a198 for broadcast com.my.app/com.google.firebase.iid.FirebaseInstanceIdReceiver

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?

Answers

Sign In or Register to comment.