我可以在Oreo之前成功地在API上的锁定屏幕上添加一个对话框。似乎谷歌不允许使用此API上的标记TYPE_SYSTEM_ERROR
。
有没有办法在Android O上的锁定屏幕上显示对话框?
适用于<的代码Android O
int flags = WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON
| WindowManager.LayoutParams.FLAG_DIM_BEHIND;
int type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
WindowManager.LayoutParams windowLayoutParams = new WindowManager.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
0,
0,
type,
flags,
PixelFormat.RGBA_8888);