2016-07-25 2 views
0

저는 Remainder Application을 만들고 있습니다. 지정된 시간에 알람을 시작하고 사용자가 알람을 멈출 때까지 반복합니다. 알람 관리자에서 알람 ID를 얻는 방법

나는 고유 번호를 생성하고 내 알람 관리기 클래스에 전달,
 PendingIntent pendingIntent = PendingIntent.getBroadcast(
       this.getApplicationContext(), remainderID.intValue(), intent, 0); 

// remainderID is unqiue value, generated from Database. 

내가 알람을 취소의 단계를 알고,하지만 난 방송 수신기 클래스에서이 ID를 얻는 방법을 이해 할 수없는입니다.

친절하게 안내해드립니다.

답변

0
PendingIntent pendingIntent = PendingIntent.getBroadcast(
      this.getApplicationContext(), remainderID.intValue(), intent, 0); 

위의 의도에 필요한 고유 한 코드 및 기타 데이터를 추가하고 아래의 AlarmService 클래스에서 동일한 의도를 추출하십시오.

public class AlarmService extends IntentService { 

    @Override 
    public void onHandleIntent(Intent intent) { 

     if (intent == null) return; 

     try 
     { 
//   send the intent to your AlarmManager class and process it there. 

      YourAlarmManager.processAlarm(intent, this);    
     } catch (Exception e){ 
      e.printStackTrace(); 
     } 
    } 
} 

희망이 있습니다. :)

관련 문제