gpt4 book ai didi

android - setFullScreenIntent 第二次不起作用

转载 作者:搜寻专家 更新时间:2023-11-01 08:03:31 26 4
gpt4 key购买 nike

我在 android 中有一个应用程序,在某些情况下我想将一个 Activity 带到前台。我为此使用 NotificationManager。这是我的代码。问题是,第一次成功地将 Activity 带到前面,但后来却没有。此外,此代码是从服务运行的。

Intent notificationIntent = new Intent(context, MainActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);

NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_launcher)
.setContentIntent(contentIntent)
.setContentTitle("Bring me front!")
.setContentText("Bring me!!! BRING!!!")
.setFullScreenIntent(contentIntent, true);

NotificationManager mNotificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(0, mBuilder.build());

最佳答案

NotificationManager 具有(未记录的)行为,如果您发布与已激活通知的 ID 匹配的新通知,它将忽略 fullScreenIntent 字段。

关于android - setFullScreenIntent 第二次不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17616631/

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