[SOLVED] Hangup button locks the screen

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

[SOLVED] Hangup button locks the screen

Postby kmichalak » Sun Mar 13, 2011 2:30 pm

Hi all!

I've implemented onKeyListener for my app, and almost everything si OK, but the only one red hangup button doesn't work. When I press this one device locks the screen. Can somebody tell me, how to deal with this?
Last edited by kmichalak on Thu Mar 31, 2011 8:33 pm, edited 1 time in total.
kmichalak
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sun Oct 24, 2010 7:36 pm

Top

Re: Hangup button locks the screen

Postby raj_J2ME » Wed Mar 16, 2011 12:35 pm

Are you getting the key code and the key event for this key inside your app ?
Are you testing the app on the emulator or read device?
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Hangup button locks the screen

Postby kmichalak » Wed Mar 16, 2011 9:33 pm

raj_J2ME wrote:Are you getting the key code and the key event for this key inside your app ?

Yes, I am
raj_J2ME wrote:Are you testing the app on the emulator or read device?

I'm using emulator for tests. Unfortunately don't have any device with that hardware buttons.
kmichalak
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sun Oct 24, 2010 7:36 pm

Re: Hangup button locks the screen

Postby raj_J2ME » Thu Mar 17, 2011 7:01 am

Well this can be issue with the emulator itself, AFAIK the app must be minimized on the hangup pressed key.
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Re: Hangup button locks the screen

Postby kmichalak » Thu Mar 31, 2011 6:11 am

I still have this problem. Event on device hangup key locks screen.
This is my method to dispatch hangup key event

Code: Select all
@Override
    public boolean dispatchKeyEvent(KeyEvent event) {
      int keyCode = event.getKeyCode();
      if (event.getAction() == KeyEvent.ACTION_DOWN) {
         if (keyCode == KeyEvent.KEYCODE_ENDCALL) {
            fireEvent();
            return true;
         } else {
            return super.dispatchKeyEvent(event);
         }
      }
    }
kmichalak
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sun Oct 24, 2010 7:36 pm

Re: Hangup button locks the screen

Postby raj_J2ME » Thu Mar 31, 2011 12:44 pm

Just a quick idea, try to fins that what value the public boolean dispatchKeyEvent(KeyEvent event) method is returning when you are pressing the HANG UP key?
Thanks with Regards,
Raj - The Kernel
raj_J2ME
Master Developer
Master Developer
 
Posts: 311
Joined: Tue Feb 15, 2011 7:40 am
Location: The Capital of India,

Top

Re: Hangup button locks the screen

Postby kmichalak » Thu Mar 31, 2011 7:07 pm

Nothing... Method is not running when hangup is pressed.
Just logcat shows line like this
03-31 20:04:08.152: DEBUG/WindowManager(59): I'm tired mEndcallBehavior=0x2

After that screen is locked.

Ok, I've found this
http://code.google.com/p/android/issues ... ry%20Stars
Since the 1.5+ API the ability to programmatically detect
KeyEvent.KEYCODE_ENDCALL has been removed from the API, so it is impossible
to detect when the ENDCALL button is pressed. [...]

Dispatching of ENDCALL button is disabled in Android 1.5 and higher.
Following http://developer.android.com/reference/ ... N_BEHAVIOR
it's possible to set one of four actions for ENDCALL button
* 0 - The end button does nothing.
* 1 - The end button goes to the home screen.
* 2 - The end button puts the device to sleep and locks the keyguard.
* 3 - The end button goes to the home screen. If the user is already on the home screen, it puts the device to sleep.
kmichalak
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sun Oct 24, 2010 7:36 pm

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: Majestic-12 [Bot] and 3 guests