【发布时间】:2016-11-23 11:00:48
【问题描述】:
我正在使用以下代码在我的 Android 手机上显示通知。我想减少用于显示通知的时间。现在,它花了大约 2 秒的时间显示,然后它被隐藏了。我想将时间从 2 秒减少到 1 秒。有可能吗?
Notification notification = new NotificationCompat.Builder(context)
.setContentTitle(context.getString(R.string.app_name))
.setContentText("Notification")
.setAutoCancel(false)
.setPriority(Notification.PRIORITY_MAX)
.setSmallIcon(R.mipmap.ic_launcher)
.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE)
.setLargeIcon(BitmapFactory.decodeResource(context.getResources(), R.mipmap.ic_launcher))
.build();
NotificationManager notificationManager = getNotificationManager(context);
notificationManager.notify(SAFER_DISCONNECTED_NOTIFICATION_ID, notification);
【问题讨论】:
标签: android android-notifications android-notification-bar