Notification passes old Intent Extras

You are sending the same request code for your pending intens. Change this: PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0); To: PendingIntent contentIntent = PendingIntent.getActivity(context, UNIQUE_INT_PER_CALL, notificationIntent, 0); intents are not created if you send the same params. They are reused.

Is it possible to create multiple PendingIntents with the same requestCode and different extras?

Actually, you don’t “create” PendingIntents. You request them from the Android framework. When you request a PendingIntent from the Android framework, it checks to see if there is already a PendingIntent that matches the criteria you pass as arguments. If so, it does not create a new PendingIntent, it just gives you back a “token” … Read more

How can I correctly pass unique extras to a pending intent?

Possibly two different issues here: 1) If you’ve already created your PendingIntent before and it “matches” an existing PendingIntent, then you must specify the PendingIntent.FLAG_UPDATE_CURRENT flag or it will not pass the extras. A “match” is based on the criteria that Intent.filterEquals() uses, so definitely read the docs there and make sure you understand the … Read more

Can’t stop the ringing alarm from another activity

Your architecture is broken. You don’t use a BroadcastReceiver for persistent processing. A BroadcastReceiver has a very short lifecycle, you use it to trigger other things. You’ve created a MediaPlayer instance in your BroadcastReceiver and are trying to control that in onReceive(). This is wrong. You should use a Service to manage and maintain the … Read more

Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified

If using java or react-native then paste this inside app/build.gradle dependencies { // … implementation ‘androidx.work:work-runtime:2.7.1’ } If using Kotlin then use this dependencies { // … implementation ‘androidx.work:work-runtime-ktx:2.7.0’ } and if anybody still facing the crash issue for android 12 then make sure you add following in AndroidMenifest.xml <activity … android:exported=”true” // in most … Read more

How to resolve “Missing PendingIntent mutability flag” lint warning in android api 30+?

You can set your pending intent as val updatedPendingIntent = PendingIntent.getActivity( applicationContext, NOTIFICATION_REQUEST_CODE, updatedIntent, PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT // setting the mutability flag ) According to the docs here: https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability 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 … Read more

Android cannot pass intent extras though AlarmManager

UPDATE: Please see Vincent Hiribarren’s solution Old Answer… Haresh’s code is not the complete answer… I used a Bundle and I tried without Bundle but I got null’s either way when I attempting to obtain the strings from the extra’s !! The exact problem, in your code, is with the PendingIntent ! This is wrong … Read more