Android Activity is displayed after user unlocks the screen
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-03-31T14:27:48Z
Indexed on
2010/03/31
15:33 UTC
Read the original article
Hit count: 623
Hi,
I was wondering if anyone understood how to make your application be displayed when you unlock the screen. I have an application where the user turns on a Bluetooth device, it connects to the phone, and the user should be presented with a UI. Having them hunt for the app or using the notification menu is not a workable option (too much work and not the obvious behavior).
The problem is that: When the screen is unlocked: - you can popup the activity from the background service when Bluetooth connects to a device - User is happy because the UI is right there
When the screen is locked: - The application gets started but is destroyed - User unlocks the phone and nothing is there but the homescreen
One work around would be to disable the keyguard when the application gets woken up but the nuclear option is a pretty bad option.
PS: I know the standard Android assumption is that you shouldn't do this. In the normal case this behavior is fine, but in this case I explicitly did something I want the phone to respond without adding more work for the user to do. As per Google's guidelines if you don't like this behavior there can be an option for you to turn this off or you can not use the application.
© Stack Overflow or respective owner