2017-11-21 15 views
0

알림을 설정할 수있는 NoteApp가 있습니다.고유 ID가있는 알람 삭제

구현하고 싶습니다. 알람을 취소 할 수 있습니다.

제 문제는 어떤 방법으로이 작업을 수행 할 수 없는지입니다.

고유 ID를 설정하여 SQLite 데이터베이스에 저장했습니다.

그래서 "예"대화 상자를 클릭하면 알람이 취소됩니다. 나는 전혀 단서가 없다

Intent i = new Intent(NeueNotiz.this,NoteNotification.class); 

PendingIntent pendingIntent = PendingIntent.getBroadcast(NeueNotiz.this, (int) System.currentTimeMillis(),i,0); 

AlarmManager alarmManager = (AlarmManager) getSystemService(ALARM_SERVICE); 

           isAlarmSet(true,String.valueOf(cal_new.getTimeInMillis())); 

           alarmManager.setExact(AlarmManager.RTC_WAKEUP,cal_new.getTimeInMillis(),pendingIntent); 

:

는 여기에 알람을 설정합니다.
도움말

답변

0
AlarmManager alarmManager = (AlarmManager) 
getSystemService(Context.ALARM_SERVICE); 
Intent myIntent = new Intent(getApplicationContext(), 
    SessionReceiver.class); 
PendingIntent pendingIntent = PendingIntent.getBroadcast(
      getApplicationContext(), 1, myIntent, 0); 

alarmManager.cancel(pendingIntent); 

더 많은 정보를 원하시면 How to cancel alarm from AlarmManager 링크를 참조하시기 바랍니다.