2017-11-21 7 views
0

私はノートアプリケーションを持っています。一意の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リンクを参照してください。