Click here to Skip to main content
15,613,470 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an Android app that can receive push notifications. When the app is running either in the foreground or background then I can detect an incoming notification and perform a background fetch to the server.

However, when the app is not running (has not been started) then the push notification arrives but the FirebaseMessagingService.OnMessageReceived method is never called. Tapping the notification will of course start the app but I want the data updated before that happens. The notification is also a "data" notification as required for background fetches.

How can I cause the incoming notification to start the app in the background so it can perform the background fetch.

N.B. I have this working fine in iOS it's just Android where I have been unable to get the app to start up when a push notification arrives.

What I have tried:

I've tried implementing this using Xamarin.Firebase.Messaging and the Firebase Push Notification Plugin for Xamarin iOS and Android. Neither seems to allow me to wake an Android up in the background for a server fetch triggered by an incoming "data" push notification.
I've searched all of the available documentation which is quite limited, Googled it to death and even resorted to SO but no joy.
Updated 20-Dec-21 4:31am

1 solution

The answer for anyone who trips over this is that the Samsung device I was testing on would not startup, other devices and emulators worked OK. So I need to find some setting in the Samsung A10 that is preventing background startup.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900