Android锁屏状态下弹出activity

caidiehuang 2014-12-02

  // 加如下设置锁屏状态下一样能跳出此activity
  // WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON//点亮屏
  // WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON//屏一直亮
  // WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED//显示在锁屏之上.activity 结束后还是锁屏
  // WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD//自动解屏.activity 结束后屏已经解了
  getWindow().addFlags(
    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON
      | WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);

相关推荐