- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在 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/
我在 android 中有一个应用程序,在某些情况下我想将一个 Activity 带到前台。我为此使用 NotificationManager。这是我的代码。问题是,第一次成功地将 Activity
Android setFullScreenIntent() execute the PendingIntent when notification reach and phone is locked.
我想知道是否有人对这种类型的通知有一些经验。 在我的用例中,我想从我的服务触发一个通知,而不是它应该打开一个全屏视频。 setFullScreenIntent 方法看起来恰好解决了这个问题,因为它在文
当通知被触发并且设备屏幕关闭时,我一直在尝试在我的应用程序中显示一个 Activity 。此 Activity 是用于处理来电的屏幕。 到目前为止,这适用于 Android Nougat(华为 P9
我想从通知中自动启动全屏 Activity ,但我在使用 setFullScreenIntent 时遇到了问题。我跟着这个:https://developer.android.com/training
我是一名优秀的程序员,十分优秀!