Open dnepromell opened 2 years ago
Any updates on this? I am also experience a lot of crashes.
@dnepromell @hsluis Hello,
Following the firebase documentation indicates this:
Caution: This is a breaking change for apps that use FCM and the deprecated Firebase Instance ID API to manage registration tokens. We strongly recommend [migrating to FCM's token APIs](https://firebase.google.com/docs/projects/manage-installations#fid-iid). If you're unable to migrate to the replacement APIs, add a direct dependency on the firebase-iid library to your build.gradle file.
adding this fixes the error: implementation "com.google.firebase:firebase-iid:21.1.0"
@Ederagp thanks for your help. Adding this library fixes the crash issue. But I noticed after it there are no push notifications.
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.
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 https://github.com/firebase/firebase-android-sdk/issues/3115 But the current version of nativescript plugin uses the old version of firebase sdk
implementation "com.google.firebase:firebase-messaging:20.1.0"