【发布时间】:2018-11-02 06:20:39
【问题描述】:
我想在后台显示通知。表示,当用户打开通知屏幕时。
但它出现在我的应用屏幕顶部。我不想显示在我的应用程序的顶部。
我只想在通知栏中显示。
有人可以建议,我必须设置的属性是什么。
【问题讨论】:
标签: android android-notifications android-8.0-oreo android-notification-bar
我想在后台显示通知。表示,当用户打开通知屏幕时。
但它出现在我的应用屏幕顶部。我不想显示在我的应用程序的顶部。
我只想在通知栏中显示。
有人可以建议,我必须设置的属性是什么。
【问题讨论】:
标签: android android-notifications android-8.0-oreo android-notification-bar
确保您的活动不是全屏。
将通知设置为低优先级
NotificationCompat.Builder mBuilder.setContentTitle(fileName)
.setContentText("Notification")
.setSmallIcon(R.drawable.icon)
.setPriority(NotificationCompat.PRIORITY_LOW)
.setAutoCancel(true)
.setContentIntent(pendingIntent);
对您的通知渠道的重要性较低
NotificationChannel channel = new NotificationChannel(CHANNEL_ID, name, IMPORTANCE_LOW);
【讨论】: