Skip to content
This repository was archived by the owner on Feb 27, 2024. It is now read-only.

FIX: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LeoAndo
Copy link

@LeoAndo LeoAndo commented Jun 20, 2022

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

Pixel5_API31.mp4

Capture: Pixel4_API29

…MUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
Copy link

@Crunchynutt Crunchynutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants