2013年12月8日 星期日

KeyGuard is deprcated,Try use WindowManager.LayoutParams.FLAG_DISSMISS_KEYGUARD


When you find references about KeyGuard or unlock keyboard on Android developer website,you may find out that "KeyguardLock class was deprecated in API level 13", it's means that this class will useless in the future.So, Try this FLAG use in WindownManager.LayoutParams when your activity on create.

Example. Alarm app on create

protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.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);
    }

沒有留言:

張貼留言