更新时间:2023-02-27 07:43:37
要回答原始问题:
Android O上似乎没有内置的方法来获取ForegroundService
的单行和正在进行的通知.可以尝试添加自定义设计,但是由于不同的手机具有不同的通知设计,因此该解决方案并不是一个很好的解决方案.
There seems to be no built-in way on Android O to get a single line, ongoing notification for a ForegroundService
. One could try adding a custom design, but as different phones have different designs for notification, that solution is hardly a good one.
但是还是有希望的:)
在 Android P 上,将NotificationChannel
中的IMPORTANCE_LOW
中优先级为PRIORITY_LOW
的通知压缩为单个行,即使对于ForegroundService
.是的!
On Android P the notification in a NotificationChannel
of IMPORTANCE_LOW
with a priority of PRIORITY_LOW
is compacted to a single line even for a ForegroundService
. Yeah!!