appactions-fitness-kotlin
appactions-fitness-kotlin copied to clipboard
FIX: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent
Crash Log
Caused by: java.lang.IllegalArgumentException: com.leoleo2.android.fitactions: 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.devrel.android.fitactions.tracking.FitTrackingService$notificationBuilder$2.invoke(FitTrackingService.kt:57)
at com.devrel.android.fitactions.tracking.FitTrackingService$notificationBuilder$2.invoke(FitTrackingService.kt:55)
at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
at com.devrel.android.fitactions.tracking.FitTrackingService.getNotificationBuilder(FitTrackingService.kt:55)
at com.devrel.android.fitactions.tracking.FitTrackingService.onCreate(FitTrackingService.kt:84)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:4554)
... 9 more
Behavior changes: Apps targeting Android 12:
https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability https://developer.android.com/guide/components/intents-filters#DeclareMutabilityPendingIntent
Capture: Pixel5_API31
https://user-images.githubusercontent.com/16476224/174583577-55bc4819-759d-458f-87c1-2accef66aa5e.mp4
Capture: Pixel4_API29
