开发者

Android Notifications

Im trying to start a new activity once i press a notification...the related code is:

NotificationManager notifManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);  

Notification note = new Notification(R.drawable.android, "New E-mail", System.currentTimeMillis());  

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

note.setLatestEventInfo(this, "New E-mail", "You have one unread message.", intent);  

notifManager.notify(NOTIF_ID, note); 

But the activity just dsnt begin..the 开发者_运维技巧notification pops up..but if i click it nothin happens...plz advice!!!


Pardon the obvious question but is DatabaseActivity referenced in your manifest?


May be you can use getApplicationContext() instead of this in the pendingIntent definition.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜