当前位置: 代码迷 >> Android >> [AndroidTips]Android how to check screen off 判断荧幕是开还是关
  详细解决方案

[AndroidTips]Android how to check screen off 判断荧幕是开还是关

热度:418   发布时间:2016-05-01 20:06:18.0
[AndroidTips]Android how to check screen off 判断屏幕是开还是关
pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);boolean screen = pm.isScreenOn();

?

如果你要监听屏幕开关的事件的话, 你需要监听这个两个ACTION_SCREEN_OFF and ACTION_SCREEN_ON intent broadcast

?

ref:http://stackoverflow.com/questions/7529733/how-to-discover-if-the-screen-is-on-or-off-while-developping-in-android

  相关解决方案