[英]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!!! 但是活动只是dsnt开始..通知弹出..但是如果我单击它,没有发生...请给我建议!
请原谅明显的问题,但是清单中是否引用了DatabaseActivity?
可能您可以在未决的Intent定义中使用getApplicationContext()代替它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.