Question

i am currently collecting information, if it is possible to make some kind of quickdraw-application for emergency purposes; i want to get the device to start a customized camera-intent once some certain key-combo is pressed.

I have check quite some information on the topic already, but it is still not clear to me how doable this whole idea is. So far i figured, that it is not meant to be by android-design. My first idea was to build some kind of InputService and make it teach the hard power-button to listen for a triple-click. But the Services arent allowed to catch KeyEvents. So, the volume-button is out of the equasion aswell.

Then i came across the idea reacting on the SCREEN ON/OFF event, but 80% of the ppl say that it is not going to work, while 20% state, that they got it. But im not really sure if they really did it.

Last but not least the question, if it is possible to launch this customized-camera-intent/application out of the locked mode.

resumé: i need to check if its possible in general to launch this camera-app (that does some quick fotos for emergency purposes) while phone is in the pocket in lock-mode. Anybody got some opinion for me? thx

Was it helpful?

Solution

The solution is to setup a BroadcastReceiver that is listening for the SCREEN_ON-Event. I did this one inside a backgroundservice that was waiting for at least two SCREEN_ON-Events within a short period of time. (less than two events obviously can't work)...

The Service then dismissed the Keyguard and was able to even pass past password/gesture and run the App. Funny fact: closing the app does pop back to desktop still beeing logged in.

I did this at Android 4.2.. Sources told me that dismissing the keyguard is not working with current Android-versions no more.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top