android - setRepeating won't cancel from other activity -


i see there lot of similar questions have alarm info stored in database. reminder cancelled inside database call deletereminder , looks this

 public boolean deletereminder(long rowid) {      return mdb.delete(database_table, key_rowid + "=" + rowid, null) > 0;   }  

this deletes reminder not alarm. tried changing

public boolean deletereminder(long rowid) {      new remindermanager(this).cancelreminder();       return mdb.delete(database_table, key_rowid + "=" + rowid, null) > 0;  } 

and added cancelreminder method in remindermanager activity this

public void setreminder(long taskid, calendar when, string spininterval) { log.e(tag, spininterval);

    long l = long.parselong(spininterval);        intent = new intent(mcontext, onalarmreceiver.class);     i.putextra(remindersdbadapter.key_rowid, (long)taskid);       pendingintent pi = pendingintent.getbroadcast(mcontext, 0, i, pendingintent.flag_update_current);       malarmmanager.setrepeating(alarmmanager.rtc_wakeup, when.gettimeinmillis(), l, pi); }  public void cancelreminder(){        intent = new intent(mcontext, onalarmreceiver.class);       pendingintent pi = pendingintent.getbroadcast(mcontext, 0, i, pendingintent.flag_one_shot);        malarmmanager.cancel(pi);       } 

but didn't work.... can show me correct code make alarm stop repeating?

use pendingintent.flag_update_current both calls pendingintent.getbroadcast(). code posted uses pendingintent.flag_one_shot second time call it.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -