如何使通知停留在最前面? [英] How to make notification stay on top?
问题描述
我有一条通知,我一直想保持在最前.
我已经给它设置了2的优先级
大多数情况下它停留在顶部,但是,假设有一个开放的WiFi网络,那么我的通知就会消失,而打开的WiFi网络的通知会放在顶部位置.
但是当我查看vlc(用于Android)支付歌曲的通知时,vlc的通知仍然排在最前面,而打开的WiFi网络的通知却消失了.
我的通知正在进行中,优先级为2.
我该怎么办.我是一个初学者,所以请多多包涵.
在此先感谢.
您尝试过此方法
NotificationCompat.Builder builder =(NotificationCompat.Builder)新的NotificationCompat.Builder(上下文).setSmallIcon(R.drawable.notify_icon).setContentTitle("Notification").setContentText(在顶部").setPriority(Notification.PRIORITY_MAX);
优先级-> PRIORITY_MAX
/ PRIORITY_HIGH
/ PRIORITY_DEFAULT
/ PRIORITY_LOW
/ PRIORITY_MIN 代码>
https://developer.android.com/reference/android/app/Notification.html#priority
正如StenSoft所说 Android:如何创建正在进行的"通知吗?I have a notification which I always want to stay on top.
I have already given it a priority of 2
Mostly it stays on top but, suppose there is a open WiFi network, then my notification goes down and the notification of open WiFi network comes on the top position.
But when I looked at the notification of vlc(for Android) paying a song, the notification of vlc stay on top and the notification of open WiFi network goes down.
I notification is ongoing and with priority 2.
What should I do. I am a beginner so please bear with me.
And thanks in advance.
have you tried this
NotificationCompat.Builder builder =
(NotificationCompat.Builder) new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.notify_icon)
.setContentTitle("Notification")
.setContentText("ON Top")
.setPriority(Notification.PRIORITY_MAX);
Priority Levels --> PRIORITY_MAX
/ PRIORITY_HIGH
/PRIORITY_DEFAULT
/PRIORITY_LOW
/PRIORITY_MIN
https://developer.android.com/reference/android/app/Notification.html#priority
and as StenSoft said Android: How to create an "Ongoing" notification?
这篇关于如何使通知停留在最前面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!