views:

274

answers:

1

I have an activity that shows up when the phone screen goes to sleep/turns off ie turns black. For some reason, the phone turns on when the volume buttons or the camera buttons are pressed. By turns on, I mean the screen wakes up or comes back from the black screen state.

I've tried using dispatchKeyEvent(KeyEvent event) and the buttons are disabled on the activity, but they still wake up the phone.

+1  A: 

You could try overriding the onKeyDown(KeyEvent) method and change what happens for those keys. However, I'm not too optimistic as if you're running an activity, it will be in an inactive state when the display is off, and also it could be that the phone is hard wired to wake up on those buttons. It could be device specific. Hard to say. Try that out and let me know how it goes, I'm currious

mtmurdock
I tried this and it didn't work. So, is there any other way to override the phone waking up with the volume and camera keys?
2Real
Im not sure, as far as i know you would have to override the OS itself. What are you trying to do anyways? i mean, if you stop the phone from waking up on a button click, wouldn't that lock up the phone forever? sounds like a bad idea to me.
mtmurdock
Well, the phone normally only comes on when the button on top of the phone is pressed. Now, the phone "wakes up" with the volume, camera, and enter buttons(button used to scroll and select stuff). I'm trying to figure out how to go back to the default behavior. I didn't do anything to enable those buttons either.
2Real
it could be that the change came as part of a system update, but you need to remember that not all phones have the same buttons and functions. i use a HTC Droid Eris and for me it only wakes up when i hit the end button (there is no "button on the top"). so ultimately i would suggest that you dont try to override those functions because you dont know what it will do to other phones.
mtmurdock
Alright, thanks for the response.
2Real