This means that the request code does not have any special meaning to Android (unlike flags, the last paramter).
You can easily check this with a simple test: - Create an Intent from an action string; - Call PendingIntent.getBroadcast twice with 0 for request code, log the results; - Repeat with different request codes, log the results. You should see something like: android.os.BinderProxy@44f8e3d0} android.os.BinderProxy@44f8e3d0} android.os.BinderProxy@44f8e3d0} android.os.BinderProxy@44f8f6b8} android.os.BinderProxy@44f8fc88} android.os.BinderProxy@44f90258} The first three are the same (all created with requestCode == 0), the next three are unique. -- Kostya 2011/1/15 kl4232 <[email protected]> > Although the docs for pendingIntent.getBroadcast state that... > > requestCode Private request code for the sender (currently not > used). > > On Jan 15, 10:07 am, kl4232 <[email protected]> wrote: > > Thank you for this. I accidently posted my question before I was > > finished composing it. > > > > So having a unique action (=feature name) for the intent inside the > > pending intent isn't enough. > > I did see, when I did "adb ahell dumpsys alarm" and I know I had 2 > > alarms set, then there was only one RTC_WAKEUP entry for my app, and > > not 2 as I would have expected. > > I'll try putting in a unique request code and see if that solves the > > problem. > > > > Thanks > > > > On Jan 15, 10:00 am, Kostya Vasilyev <[email protected]> wrote: > > > > > > > > > Alarms are keyed on PendingIntents, there can be only one for a given > > > pending intent. This is so you can update settings for an already-set > alarm. > > > > > There are rules for when PendingIntents are considered the same intent, > or > > > different ones. Using the same Java object certainly means it's the > same > > > intent though. > > > > > What you can do is use a request code with PendingIntent.getBroadcast > that's > > > unique for each alarm you want to set - three alarms, three request > codes, > > > three unique PendingIntents. > > > > > -- Kostya > > > > > 2011/1/15 kl4232 <[email protected]> > > > > > > I have an app which I want to have 3 wake-up alarms to schedule 3 > > > > features of the app. > > > > They are all set the same way..... > > > > > > m_intentName = "com.mypackage."+ FeatureName; > > > > m_alarmIntent = new Intent(m_intentName); > > > > m_alarmPendingIntent = PendingIntent.getBroadcast(this, 0, > > > > m_alarmIntent, 0); > > > > > > When I want to set the alarm I do this... > > > > m_alarmMgr.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + > > > > nMinutes * 60 * 1000, m_alarmPendingIntent); > > > > > > Then in my broadcast receiver... > > > > public class FeatureReceiver extends BroadcastReceiver { > > > > public void onReceive(Context context, Intent intent) { > > > > if (intent.getAction().compareTo(m_intentName) > == 0) > > > > { > > > > > > -- > > > > You received this message because you are subscribed to the Google > > > > Groups "Android Developers" group. > > > > To post to this group, send email to > [email protected] > > > > To unsubscribe from this group, send email to > > > > [email protected]<android-developers%[email protected]> > <android-developers%2Bunsubs[email protected]> > > > > For more options, visit this group at > > > >http://groups.google.com/group/android-developers?hl=en-Hide quoted > text - > > > > > - Show quoted text -- Hide quoted text - > > > > - Show quoted text - > > -- > You received this message because you are subscribed to the Google > Groups "Android Developers" group. > To post to this group, send email to [email protected] > To unsubscribe from this group, send email to > [email protected]<android-developers%[email protected]> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

