Kindle Fire permission and disable_keyguard

So based on https://developer.amazon.com/help/faq.html#KindleFire Kindle Fire doesn't support disable_keyguard permissions.

But I want my app to run on both regular Android devices and Kindle. Is there a simple solution to this problem?

And that permission should be there, so I can't just remove it from the app.

+3


source to share


3 answers


You can simply surround the disableKeyguard () call with try catch and do some extra 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
}

      

+3


source


Not sure what the context of your application is, but what about Wake Lock? It might cost you some battery life.



0


source


You will need two versions of your application, one for Fire and one for your existing goals. You could do this by putting the bulk of your logic in an Android library project that is shared between two regular Android projects (one with the keyboard lock feature, one without).

0


source







All Articles