android / health-samples

Apache License 2.0
248 stars 142 forks source link

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

Closed dharmraj2018 closed 6 months ago

dharmraj2018 commented 6 months ago

FATAL EXCEPTION: pool-4-thread-1 Process: com.example.exercise, PID: 9314 java.lang.IllegalArgumentException: com.example.exercise: 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:401) at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:671) at android.app.PendingIntent.getBroadcast(PendingIntent.java:658) at androidx.work.impl.utils.ForceStopRunnable.getPendingIntent(ForceStopRunnable.java:196) at androidx.work.impl.utils.ForceStopRunnable.isForceStopped(ForceStopRunnable.java:128) at androidx.work.impl.utils.ForceStopRunnable.run(ForceStopRunnable.java:93) at androidx.work.impl.utils.SerialExecutor$Task.run(SerialExecutor.java:91) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) at java.lang.Thread.run(Thread.java:1012)

yschimke commented 6 months ago

Thanks, fixing in https://github.com/android/health-samples/pull/210