Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Highlighted
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

keyControl capturing headset and phone controls

Hi everyone,

 

I cannot seem to find a way for my screen to capture te headset click. 

How is that done? (I am using a single button headset)

I would like to use it as a jump commnad for a sample game.

 

Also, could not find a way to keyControl the GREEN and RED key. 

 

am I blind or what ?

 



"Listen carefully, I shall say this only once"
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: keyControl capturing headset and phone controls

the red and green keys are not handled by the screen class, the system intercepts them. it seems likely that the headset key is handled the same way.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 412
Registered: ‎09-12-2008
My Device: 9000 9810

Re: keyControl capturing headset and phone controls

Hmmm...

That means every game experience on BB is burdened with a fright of pressing the green key which might initiate a call in the background ?

 

Sounds scary Smiley Happy

 

 

This means I cannot even use it to pause my playback or something like that? 

 

Anyway, thanks for the info

 

Do you know that this cannot be done (or is it a guess)? maybe keyListener (tried it, no can do).

Anyone has an idea ?

 

 



"Listen carefully, I shall say this only once"
Developer
Posts: 17,011
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: keyControl capturing headset and phone controls

pressing the green key opens the phone application, pressing the red key requests background for the current application or, if there is a phone call active, hangs up the call and opens the phone application.

for your game that means: you should pause the game whenever your game loses the foreground. this can happen due to the green key or an incoming call, a calendar alert etc.

to conclude: no, you can not capture (or even detect) the key presses - but you can react on the events they initiate.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 91
Registered: ‎02-04-2009
My Device: Not Specified

Re: keyControl capturing headset and phone controls

You can detect and capture the send and end keys (green and red) by using keyDown and keyUp instead of keyControl.