做即时通讯软件,当有语音或视频来电时,需要默认亮屏解锁就需要下面的操作了
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED //锁屏显示
| WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD //解锁
| WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON //保持屏幕不息屏
| WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);//点亮屏幕
或者setShowWhenLocked(true);