Android 12 firebase push notifications don't work when app is in the background

Viewed 2917

I'm sending test push notifications form firebase>compose notification page. I receive push notifications on Android 8, 9, 10, 11, but not 12.

And I have two devices on Android 12: physical phone Samsung S22 and Pixel emulator. In both cases Push Notifications don't appear in the Notification tray.

Note:

  • I'm speaking about notification which system shows in the Notification tray while app is being in the background. When app is in the foreground, then onMessageReceived works as expected on Android 12.
  • token is correct
  • in all cases I close the app in order to get Push in Notification tray
  • if I use android:exported="false" - still doesn't work

My service in the android manifest:

        <service
            android:name=".old.push.FCMHandlerService"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.google.firebase.MESSAGING_EVENT" />
            </intent-filter>
        </service>
2 Answers

In my case i was using an old version of react native firebase and i made the changes for the pending Intent. However the error appear by using an old dependency in my build.gradle inside the app folder which hadn't solved the pending intent change. I just upgraded the versions of "com.google.firebase:firebase-messaging:xxx for the following

implementation "com.google.firebase:firebase-iid:21.1.0"
implementation "com.google.firebase:firebase-messaging:22.0.0"

For more infor check this issue: https://github.com/EddyVerbruggen/nativescript-plugin-firebase/issues/1876

Related