Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to remove already defined pending intent
    primarykey
    data
    text
    <p>I have problem with alarm manager pending intent. I have read in document that <strong>Determine if two intents are the same for the purposes of intent resolution (filtering). That is, if their action, data, type, class, and categories are the same. This does not compare any extra data included in the intents. Parameters</strong></p> <p>And <strong>set method of alarm manager will remove or replace If there is already an alarm for this Intent scheduled (with the equality of two intents being defined by filterEquals(Intent)).</strong></p> <p>But when I implement using same concept my alarm manager will not filter equal intent and prevent to add same data to pending intent.</p> <p>My code is</p> <pre><code>public void setalarm() { int[] IDs = { 1, 2, 3 }; int[] type = { 0, 1, 0 }; String[] name = { "not", "yes", "not" }; Date[] dt = { new Date(2012, 2, 28, 11, 51), new Date(2012, 2, 29, 10, 55), new Date(2012, 2, 28, 11, 51) }; for (int i = 0; i &lt; 3; i++) { AlarmManager am = (AlarmManager) context .getSystemService(Context.ALARM_SERVICE); Intent send = new Intent(context, service.class); send.setAction("com.app.main"); send.setData(Uri.parse(type[i] + " " + name[i] + " " + dt[i])); PendingIntent pintent = PendingIntent.getService(context, IDs[i], send, PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT); try { am.cancel(pintent); } catch (Exception e) { } am.set(AlarmManager.RTC_WAKEUP, dt[i].getTime(), pintent); } } </code></pre> <p>When alarm call service on start method, it will call two times from id 1 as well as 3. but I have setdata same in id=1 and id=3;</p> <p>but user can only set alarm for id =1 not for 3 because 1st and 3rd are same</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload