4

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

0

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

2 Comments

This was the perfect solution, tree shaking is a monster
Thank you! I spent hours searching for a solution, and this works perfectly

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.