更新时间:2023-02-26 21:44:20
通常来说,你做不到.在DND模式下,即使具有 MAX 优先级的通知也不会显示.
Generally speaking you can't. Even notification with MAX priority wont be shown in DND mode.
我可以想象的可能的解决方法是使用android.permission.SYSTEM_ALERT_WINDOW
在系统窗口上绘制自定义通知(FB Messanger的工作方式与此类似):
The possible workaround that I can imagine is to use android.permission.SYSTEM_ALERT_WINDOW
to draw custom notification over system window (FB Messanger works in similar way) : Creating a system overlay window (always on top) .
But this method is suitable only in rare cases and most of the time it's a violation of Android UI/UX best practices.