Search code examples
androidpermissionskindle-fire

Kindle Fire and disable_keyguard permission


So based on https://developer.amazon.com/help/faq.html#KindleFire Kindle Fire is NOT supporting disable_keyguard permission.

But I want that my application runs both on normal android devices and on kindle. Is there any simple solution to this problem?

And this permission is a must have so I can't just remove it from application.


Solution

  • You could just surround disableKeyguard() call with try catch and perform some additional logic there.

    KeyguardManager kgm = (KeyguardManager) Application.getSystemService(Application.KEYGUARD_SERVICE);
    KeyguardManager.KeyguardLock kl = kgm.newKeyguardLock(VIEW_LOG_TAG);
    try{
        kl.disableKeyguard();
    }
    catch (SecurityException e)
    {
        //kindle code goes here
    }