-
Notifications
You must be signed in to change notification settings - Fork 440
Android 12 background notification led to crash (PendingIntent) #1876
Comments
Any updates on this? I am also experience a lot of crashes. |
@dnepromell @hsluis Hello, adding this fixes the error: |
@Ederagp thanks for your help. So I also changed "com.google.firebase:firebase-messaging:20.1.0" to "com.google.firebase:firebase-messaging:21.1.0" And now all works perfectly on Android 12 and the versions below. |
Thanks @dnepromell. I added these lines to my app.gradle file and now my push notifications work: dependencies {
implementation "com.google.firebase:firebase-iid:21.1.0"
implementation "com.google.firebase:firebase-messaging:22.0.0"
// ...
}
android {
compileSdkVersion 31
defaultConfig {
targetSdkVersion 31
// ...
}
// ...
} I changed the version of firebase-messaging to 22.0.0 because v. 21.1.0 had a bug where tapping a notification would not launch the app. |
after this change android 12 is working fine but old version not getting notification !!! |
@yashpyraj which Android versions are you getting issues on? This seems to be working on Android 10,11,12 for me |
"@nativescript/firebase": "^11.1.3"
compileSdkVersion 31
targetSdkVersion 31
Crash stacktrace:
An uncaught Exception occurred on "Firebase-MyFirebaseMessagingService" thread.
com.uboro.mobile: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
StackTrace:
java.lang.IllegalArgumentException: com.uboro.mobile: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles.
at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
at android.app.PendingIntent.getActivity(PendingIntent.java:444)
at android.app.PendingIntent.getActivity(PendingIntent.java:408)
at com.google.firebase.messaging.zzb.zza(com.google.firebase:firebase-messaging@@20.1.0:59)
at com.google.firebase.messaging.zzd.zza(com.google.firebase:firebase-messaging@@20.1.0:33)
at com.google.firebase.messaging.FirebaseMessagingService.zzc(com.google.firebase:firebase-messaging@@20.1.0:69)
at com.google.firebase.messaging.zze.run(com.google.firebase:firebase-messaging@@20.1.0:2)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6)
at java.lang.Thread.run(Thread.java:920)
The bug in the firebase was fixed in firebase/firebase-android-sdk#3115
But the current version of nativescript plugin uses the old version of firebase sdk
implementation "com.google.firebase:firebase-messaging:20.1.0"
The text was updated successfully, but these errors were encountered: