2014-10-18 3 views
0

내 앱에서 알림을 생성합니다. 사용자는 알림 시간을 설정할 수 있습니다. 영원한 서비스를 만드는 방법, 장치 시간을 확인하고 누가 사용자 설정 시간과 동등한지를 결정하는 사람은 알림을 출력하십시오. 나는 이것을 좋아하지만 몇 번 일하고 죽는다. 나는 무엇을 잘못 했는가?영원한 알림 서비스

void redinder2() {  

for (int i = 1; i<=10; i++) { 

    Calendar calendar = Calendar.getInstance();  
    hour = calendar.get(Calendar.HOUR_OF_DAY); 
    minute = calendar.get(Calendar.MINUTE); 

    if(hour==my_hour&&minute==my_minyte){){ sendNotif();}  

     if(i==10){startService(new Intent(this, MyService.class));} 
      try { 
      TimeUnit.SECONDS.sleep(59); 
      } catch (InterruptedException e) { 
      e.printStackTrace(); 
      } 
} 

}

답변