iterable-android-sdk icon indicating copy to clipboard operation
iterable-android-sdk copied to clipboard

[bug] android 12 crash PendingIntent FLAG_MUTABLE flag

Open gturedi opened this issue 3 years ago • 6 comments

if i set app target level to 31. iterable sdk crashed the app when showing notification on android 12 devices. here logs:

Fatal Exception: java.lang.IllegalArgumentException com.popcornvan.app: 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. android.app.PendingIntent.checkFlags (PendingIntent.java:382) android.app.PendingIntent.getBroadcast (PendingIntent.java:660) com.iterable.iterableapi.IterableNotificationHelper$IterableNotificationHelperImpl.createNotification (IterableNotificationHelper.java:195) com.iterable.iterableapi.IterableNotificationHelper.createNotification (IterableNotificationHelper.java:37) com.iterable.iterableapi.IterableFirebaseMessagingService.handleMessageReceived (IterableFirebaseMessagingService.java:62) com.popcornvan.orderingapp.util.firebase.PopcornFirebaseMessagingService.onMessageReceived (PopcornFirebaseMessagingService.kt:14) com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage (com.google.firebase:firebase-messaging@@22.0.0:13)

it is for pending intent, it should like below:

val pendingIntent = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { PendingIntent.getActivity(this, 0, activityIntent, PendingIntent.FLAG_IMMUTABLE) } else { PendingIntent.getActivity(this, 0, activityIntent, PendingIntent.FLAG_UPDATE_CURRENT) }

gturedi avatar Feb 14 '22 09:02 gturedi

Any update on this issue? This will prevent us from using Iterable on devices targeting API 31 and above.

masterwok avatar Apr 26 '22 15:04 masterwok

Same issue here. Looking for a resolution timeline. Thank you!

ryanrampage1 avatar Apr 26 '22 16:04 ryanrampage1

Which version of the Iterable SDK are you using? If it's below 3.4.2, have you tried updating to the latest version?

vbabenkoru avatar Apr 26 '22 17:04 vbabenkoru

Ah that was it, missed the minor releases on the release note page. You may consider rewording it as it is not super clear that there have been releases outside of what is listed there. Would also argue that this is a major release and should have been documented there regardless as it was enabling compatibility for 31+.

https://support.iterable.com/hc/en-us/articles/360027543332-Release-Notes-Iterable-s-Android-SDK-

ryanrampage1 avatar Apr 26 '22 17:04 ryanrampage1

Facing the same issue, it's not possible to update android SDK to 31 due to Iterable dependency

rkushch-asp avatar May 02 '22 20:05 rkushch-asp

@rkushch-asp which version are you using? I ended up getting it working with
implementation 'com.iterable:iterableapi:3.4.5'

ryanrampage1 avatar May 02 '22 20:05 ryanrampage1