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

java.lang.SecurityException: !@Too many alarms (500) registered from pid 10790 uid 10206

Unlike what the comment suggests, this might not be your fault. This started happening for us in production code somewhere mid March, this only happens on Samsung with Lollipop which only recently started to be rolled out. Update: This issue finally happened on one of the phones we have available. like @goncalossilva said the problem … Read more

AlarmManager Android Every Day

This code will run the Intent each day on 1 PM or 2 PM Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, 13); // For 1 PM or 2 PM calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); PendingIntent pi = PendingIntent.getService(context, 0, new Intent(context, MyClass.class),PendingIntent.FLAG_UPDATE_CURRENT); AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); am.setRepeating(AlarmManager.RTC_WAKEUP, calendar.getTimeInMillis(), AlarmManager.INTERVAL_DAY, pi);

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

android: running a background task using AlarmManager

Here is one complete example: http://android-in-practice.googlecode.com/svn/trunk/ch02/DealDroidWithService/ The pattern this example uses, and one that I’ve found that seems to work well, is to use a boot receiver to setup the AlarmManager (and of course also check to start the polling from your main Activity too, for the case when your app is installed and the … 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