我有一個活動(設置報警),創建一個重複報警,我需要從另一個活動取消該報警(取消報警)。我無法取消警報。我在做什麼錯?:AlarmManager不取消我的設置重複報警
public class settingalarm...
am =(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent alrm = new Intent(context, z.class);
alrm.setAction(ALARM);
alrm.putExtra(x, x);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, alrm, 0);
am.setRepeating(AlarmManager.RTC_WAKEUP, 0, 30000, alarmIntent);
我有需要取消現有的報警另一個活動:
public class cancelingalarm...
am =(AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent alrm = new Intent(context, z.class);
PendingIntent alarmIntent = PendingIntent.getBroadcast(context, 0, alrm, 0);
am.cancel(alarmIntent);
提前感謝!
試試這個鏈接,並申請代碼, [http://stackoverflow.com/questions/3330522/how-to-cancel-this-repeating-alarm][1] [ 1]:http://stackoverflow.com/questions/3330522/how-to-cancel-this-repeating-alarm –