2011-10-12 3 views
0

일부 알림 코드는 아래에 있습니다. 알림 코드를 사용하여 달성하고자하는 것은 알림을 클릭하면 사용자가 특정 클래스로 이동하게됩니다. 내가 알림을 클릭하면, 여기에이 코드가 선언 된 클래스로 이동하도록되어 있으리라 믿고있어특정 클래스로 이동하는 알림을 클릭하십시오.

final int NOTIF_ID = 1234; 

    NotificationManager notifManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 
    Notification note = new Notification(R.drawable.icon, "New Offers CLOSEBY!", System.currentTimeMillis()); 

    PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, intentTHING.class), 0); 

    note.setLatestEventInfo(this, "You have 5 new offers", "Please CLICK THIS Notification to see what is avaliable!", intent); 

    notifManager.notify(NOTIF_ID, note); 

: 여기 내 알림 코드

PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, intentTHING.class), 0); 

그러나, 그것은하지 않습니다, 알림이 나타나지만 내 코드에서 참조한 클래스를 볼 수 없습니다 (클릭하면 해당 클래스로 이동하지 않습니다). 다른 클래스에서 버튼을 누르면 알림 팝업이 나타납니다. 사용자가 알림을 클릭하면 해당 화면을 누르고 intentTHING.class로 바꿔야합니다. 내가 누락 된 부분에 대한 아이디어가 있습니까? 이 같은

답변

1

설정 출원 의지 : 확실하지만,이 작업을 수행하여 그것을 밖으로 시도 할 수 없습니다

PendingIntent intent = PendingIntent.getActivity(this, 0, new Intent(this, intentTHING.class), 0); 
note .contentIntent = intent; 

note.setLatestEventInfo(this, "You have 5 new offers", "Please CLICK THIS Notification to see what is avaliable!", intent); 
notifManager.notify(NOTIF_ID, note); 
+0

코드에 추가했지만 여전히 원하는 클래스를로드하지 않습니다. –

+0

매니페스트 파일에 액티비티를 추가 했습니까? Plz 확인 및 클래스가 간단한 자바 클래스가 아닌 액티비티가되기를 바랍니다. –

+0

FFFFFUUUUUUUUUUUUUUU,하지만 이전에 본 적이없는 철자법 오류가있었습니다. MASSIVE fail -_- –

0

암 ..

PendingIntent 의도 = PendingIntent.getActivity (문맥, 0, 새로운 의도 (this, intentTHING.class), PendingIntent.FLAG_UPDATE_CURRENT | Notification.FLAG_AUTO_CANCEL);

관련 문제