gpt4 book ai didi

java - 在 android 版本 4.0 上单击通知时, Activity 永远不会启动

转载 作者:太空宇宙 更新时间:2023-11-03 10:51:45 27 4
gpt4 key购买 nike

通知的实现代码如下:

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 Dev 的代码

它在 ICSpre ICS 上工作流畅

我最近检查了这段代码

关于java - 在 android 版本 4.0 上单击通知时, Activity 永远不会启动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12292901/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com