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
Contributor
Posts: 19
Registered: ‎04-20-2011
My Device: BlackBerry Pearl
Accepted Solution

Background application that listens on keypad.

[ Edited ]

Hello everyone,

I am trying to create an application targetting 5.0 devices, that will enable the backlight when a sequence of characters are typed on nowhere, but keypad.

 

Any gueses how to implement a listener in an application like that?

 

Thanks in advance.

Developer
Posts: 19,612
Registered: ‎07-14-2008
My Device: Not Specified

Re: Background application that listens on keypad.

Welcome to the forums.

 

If you search the forum you will find that other people have asked similar question.  The key listener API is designed to work when the active application is in the foreground.  In other words, if your application does not have the screen, then you won't be able to intercept the keyboard events like someone pressing "A" 3 times.

 

Search for more information. 

 

I thought the backlight came on when you pressed a key anyway?

Contributor
Posts: 19
Registered: ‎04-20-2011
My Device: BlackBerry Pearl

Re: Background application that listens on keypad.

Hello Sir,

Sorry for the mistake.. The key input would be a short cut to my application. This invokes my application and from there the flash light turns on. This may happen like toggle. Like torch which goes off on another switch hit.

 

If this is accomplished, more things can be done.

Regards.

Developer
Posts: 16,495
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Background application that listens on keypad.

still not possible
----------------------------------------------------------
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
Contributor
Posts: 19
Registered: ‎04-20-2011
My Device: BlackBerry Pearl

Re: Background application that listens on keypad.

Ok, it could be convenience key that is manually set by user as a shortcut to my application..

Or event thrown by accelerometer from a background service, which could activate my application..

Let me see this can happen. 

I shall be reporting this is success or not..

Developer
Posts: 16,495
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Background application that listens on keypad.

yes, the convienience key is possible, and sensor readings as well
----------------------------------------------------------
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
Contributor
Posts: 19
Registered: ‎04-20-2011
My Device: BlackBerry Pearl

Re: Background application that listens on keypad.

Accelerator is happening, but you have to shake hard!!. Otherwise I would need my application to be notified (it runs on autostart, so it is already running) when the hot (convenience) key is pressed.

 

I think of using another (secondary) application that notifies the main (backlight) application (and that secondary application starts on hotkey, notifies and closes), back light is switched on in an event. Then again this hot key is pressed, the main application is notified, to turn it off, and the secondary application closes.

 

There could be a direct way of doing it. I mean: do I need this secondary application?