트리거에서 Activity
노트를 만듭니다! 그리고 Alarm
이 3Alarm
생성하는 경우 Alarm
의미 만 마지막 트리거 삭제, 다른 Activity
코드를 삭제하고 나는 Alarm
1가 삭제를 삭제하고 싶지만 Alarm
1의 시간에 도달하면 그것은 이미 삭제하는 동안 트리거 및 Alarm
2 및 3 정적 브로드 캐스트 ID에서만 알람 예를 들어 알람이 마지막으로 울림 트리거가 다른 활동에서 코드 삭제 다른 활동에서 동일한 보류 의도를 사용하여 삭제하는 경우 어떻게 보류중인 의도를 사용할 수 있습니까? 내 삭제 경보 activit에서 트리거 경보를 사용하는 y다른 활동을 사용하여 여러 알람을 취소하는 방법
AlarmManager alarmMgr = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(getApplicationContext(), AlarmReceiver.class);
String alertTitle = mTitleText.getText().toString();
intent.putExtra(getString(R.string.alert_title), alertTitle);
// broadcastCode++;
PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), broadcastCode, intent, PendingIntent.FLAG_UPDATE_CURRENT);
alarmMgr.set(AlarmManager.RTC_WAKEUP, calender.getTimeInMillis(), pendingIntent);
cv.put(mDbHelper.TIME, timeString);
cv.put(mDbHelper.DATE, dateString);
public void delete(int id)
{
db.delete(DbHelper.TABLE_NAME, DbHelper.C_ID + "="+id, null);
db.close();
Intent intent = new Intent(getBaseContext(), AlarmReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(getBaseContext(), CreateNote.broadcastCode, intent, 0);
AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
alarmManager.cancel(pendingIntent);
}
목록에서 하나의 알람이 생성되었지만 목록에서 여러 개의 알람이 생성 된 경우 총 ** 5 ** 알람이 생성되고 처음으로 생성 된 알람 ** 1 **이 삭제됩니다 알람이 발생하면 시간에 따라 트리거되고 알람 ** 2,3,4,5 **는 트리거되지 않습니다. –
개별 알람은 'REQUEST_CODE'및 'PendingIntent'로 래핑 된 원본'Intent '로 식별됩니다. . 'REQUEST_CODE' (데이터베이스에 저장하는 것처럼 보임)와'Intent'가 알람 설정시 지정한 값과 일치하는지 확인해야합니다. –
당신은 REQUEST_CODE를 말하고 의도는 데이터베이스에 저장해야합니다. –