簡體   English   中英

在Android 4.0版上單擊通知時,永遠不會啟動Activity

[英]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未啟動,並且沒有任何反應。

我不知道是什么原因。

我不確切知道你的代碼中的問題,但如果你使用Android開發的代碼

它在ICSICS之前是無效的

我最近檢查了這段代碼

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM