Reputation: 63
We have two apps the first app sends a request to Backend(Laravel) then the backend sends the notification to firebase(we receive the correct response from firebase) and the second app should receive a notification, everything works fine in the debug mode(when my phone is connected to Android Studio) once I release it on Google play it doesn't work, the second app doesn't receive any Notification.
I added the SHA1 for each app in firebase, each app has 2 SHA1
1- App signing key certificate
2- local SHA1
also the "Android key (auto created by Firebase)" is restricted with the SHA1 keys for the apps
The issue only happens in release mode
I did download a new version of google-services.json after adding the keys and uploaded the bundle to play console
What I'm missing here? Thanks
Upvotes: 4
Views: 2142
Reputation: 71
Found the answer in this flutterfire issue.
You have to prepend the following line to your background message handler:
@pragma('vm:entry-point')
Future<void> _firebaseMessagingBackgroundHandler(RemoteMessage message) async {
// handle message
}
It will prevent the handler from being removed during tree shaking when building for release mode.
Upvotes: 7