Reputation: 1973
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.
Upvotes: 3
Views: 3055
Reputation: 881
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
}
Upvotes: 3
Reputation: 1007494
You will need two editions of your app, one for the Fire and one for your existing targets. You could accomplish this by putting the bulk of your logic in an Android library project, shared between two regular Android projects (one with the keyguard feature, one without).
Upvotes: 0
Reputation: 93
Not really sure what the context is of your application, but how about a Wake Lock? This could cost you some battery life though.
Upvotes: 0