2014-01-10 4 views
0

여기에 로컬 알림을 받기 위해 알람 관리자를 사용하고 있습니다. 내 코드는 완벽하게 실행되며 모든 알람 및 알림은 적시에 이루어집니다. 하지만 알림을 클릭하면 앱에 Act_Remainder 클래스가 있어야합니다. 이 문제를 해결하는 방법은 무엇입니까?알람 관리자 (알림)와 보류중인 의도

Intent intent1 = newIntent(this.getApplicationContext(), Act_Remainder.class); 

    if(intent!=null){ 
     userID = intent.getStringExtra("UserID"); 
     userID1 = intent.getStringExtra("UserID1"); 
     ID = intent.getIntExtra("ID", 0); 
    } 

    Notification notification = new Notification(R.drawable.ioc_icon, 
    userID1, System.currentTimeMillis()); 

    intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP); 

PendingIntent pendingNotificationIntent =  PendingIntent.getActivity(this.getApplicationContext(), 0, intent1, PendingIntent.FLAG_ONE_SHOT); 


notification.flags |= Notification.FLAG_AUTO_CANCEL; 
+0

내 질문을 편집하기위한 모든 사람에게 Thannx가 있지만이 문제를 해결하는 데 도움을 줄 수있는 사람이 있습니까? ????????? – krishna

+0

replending PendingIntent.FLAG_ONE_SHOT to PendingIntent.FLAG_UPDATE_CURRENT –

+0

@Lucky 나는 이것을 시도했지만 알 수없는 시간에 빈 알림 하나를 보냈습니다. 1 시간 30 분 후 ...이 시간은 결정되지 않았습니다. – krishna

답변

1

또는 단순히 이것을 사용 ...

공공 무효 ONSTART (의도 의도 INT startID가) { super.onStart (의도, startID가);

mManager = (NotificationManager) this.getApplicationContext() 
      .getSystemService(      this.getApplicationContext().NOTIFICATION_SERVICE); 

    Intent intent1 = new Intent(this.getApplicationContext(),Act_DashBord.class); 
Notification notification = new Notification(R.drawable.applogo_57x57, 
      "Muslim Companion", System.currentTimeMillis()); 

    intent1.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP 
      | Intent.FLAG_ACTIVITY_CLEAR_TOP); 

    PendingIntent pendingNotificationIntent = PendingIntent.getActivity(
      this.getApplicationContext(), 0, intent1,PendingIntent.FLAG_UPDATE_CURRENT); 


    notification.flags |= Notification.FLAG_AUTO_CANCEL; 

    int id = 0; 
    if (intent != null) { 
    String message = intent.getStringExtra("Message"); 
     id = intent.getIntExtra("Id", 0); 
    }   

      notification.setLatestEventInfo(this.getApplicationContext(), 
      "Muslim Companion", message, pendingNotificationIntent); 
    long count = System.currentTimeMillis(); 
    mManager.notify(Integer.valueOf(id), notification); 


    mManager.cancel(Integer.valueOf(id)); 

} 
+0

고맙습니다 내 문제를 해결 .. – krishna

+0

편집 해 주셔서 감사합니다. 작업 영역에서 복사하여 붙여 넣기 문제입니다. –

관련 문제