FCM Unity plugin Data messages in background

Is there any way in which I can get the data message (not notification messages) when app is in background. I don’t mind writing native Java code and adding an aar file, but I need to get the data messages from Firebase in my Android app even when my app is in background.

For now I know firebase unity plugin actually caches the data messages when in background and gives the callback when app is launched, but it does not serve the purpose of a push notification, i.e. to bringing a user back to the app. I know this must be possible, but not how.

Or is there a way of doing this without Firebase Unity plugin, i.e. by using native firebase-messaging aar library?

No update on this yet?

Unity is a foreground activity like almost all apps. Android can only have one foreground app at a time. When you switch to another app your app is essentially out of business. At this time the OS can actually decide to completely kill your app if memory is needed.

What you need is creating a native background service this might be a good start. I haven’t used firebase so i can’t help you any further here. However you should start reading the documentation and the API reference