[英]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.