[英]Activity is never launched when the notification is clicked on android version 4.0
这是通知的实现代码:
Notification notification = new Notification();
RemoteViews expandedView = new RemoteViews(mContext.getPackageName(),
R.layout.status_bar_ongoing_event_progress_bar);
// ignore the setup code for expanedView
notification.contentView = expandedView;
Intent intent = new Intent(mContext, MyActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
notification.contentIntent = contentIntent;
mNotificationMgr.notify(notification_id, notification);
这个代码在Android设备2.2上工作正常,但是,这在Android设备4.0上不起作用。 当用户单击通知时,MyActivity未启动,并且没有任何反应。
我不知道是什么原因。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.