2
私はアラームアプリを開発中です。 アラームを発生させると、無効化ボタンで通知がスローされます。 無効ボタンをクリックすると、アラーム着信音とアラームも停止するはずです。アラームとアラームの着信音を一緒に止める
無効ボタンをクリックすると、以下のメソッドが呼び出されます。 アラームを停止します。 しかし、私は同じ時間で次の日のためにこの着信音が生きているか、それとも警報を忘れるでしょうか?
public void dismissRingtone() {
// stop the alarm rigntone
Intent i = new Intent(this, RingtonePlayingService.class);
stopService(i);
// also dismiss the alarm to ring again or trigger again
AlarmManager aManager = (AlarmManager) getSystemService(ALARM_SERVICE);
Intent intent = new Intent(getBaseContext(), AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
aManager.cancel(pendingIntent);
// Canceling the current notification
NotificationManager notificationManager =
(NotificationManager)getSystemService(getApplicationContext().NOTIFICATION_SERVICE);
notificationManager.cancel(321);
}
ここでは保留中のインテントをキャンセルします。それは放送受信機を意味します.... – Shaon
私のコードでは、私は現在のアラームをキャンセルしています。しかし、翌日にはまだ驚くでしょうか? – Shaon
ブロードキャスト受信者+予定保留中のインテントは、再度スケジュールしない限りキャンセルされることを知りたいと思います。 – Pehlaj