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
Developer
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Help needed for Background Application

Hi,

 

I want to create an app that could be launched using the icon.

There is only one screen which is used to enable or dissable the background process this aap runs.

If process is enabled then when ever user presses a combination of two buttons, some action occurs say play sound

If process is disabled and user presses the combination buttons, nothing happens.

 

Please help me creating the background process and implement the two button combination.

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Help needed for Background Application

Search for next terms:

application autostartup,

alternative entry point,

persistent object,

KeyListener,

MainScreen,

ButtonField

 

Thanks,

Eugen

Developer
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: Help needed for Background Application

Thanks Eugen,

 

But can you be more specific ?

If have implemented the code for keylistener.

The application works till it is in foreground.

 

I want to have it working in background and listening to key presses all the time.

 

I have not used threads or any alternate entry point.

Please let me know how I can listen the key strokes from background running app?

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help needed for Background Application

Rather than explaining the aspects of this application in more detail, perhaps we can see if this application will, in fact, never work for you.

 

The ability of background applications to receive key events varies according to the device, the OS level and the state of the device.  However I can say with some certainity that it is not possible to have a background listener that will pick up general keys (like the letters and numbers) at any time.  In fact, the only keys for which this might be possible, some of the time and for some OS levels, are the 'special keys', like the Red phone key.

 

To test this, you actually have to try on device.  The Simulator and the device behave differently in my experience. 

 

Given this restriction, is there any value in continuing to develop this application? 

Developer
Posts: 467
Registered: ‎07-16-2009
My Device: Z10 LE
My Carrier: Vodafone NL

Re: Help needed for Background Application

[ Edited ]

If your original question was about KeyListener I would suggest you be more concrete. Because my original reaction was that you are asking to write whole application for you. After I've looked from another point of view. That one expirienced developer, from other platform, asks what API  to use to build such kind of application.

Sorry for misunderstanding.

 

But thanks to Peter and his expirience there is no chance to build general app for key listening.

 

Peter, I never did such listener before. I've just googled that KeyListener can handle keys in background.

 

 

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

Re: Help needed for Background Application

" I've just googled that KeyListener can handle keys in background."

 

Yes I got the same impression, which is why I wrote a generic keylistener and tried it in a variety of devices I had, in various states, locked, unlocked, standby etc. etc.  Results were inconsistent to say the least....

Developer
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: Help needed for Background Application

So how can I do that?

I need some code help

Do I need to create any thread or function

 

Thanks

Abhinav Tyagi

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help needed for Background Application

"So how can I do that?"

 

How can you do what?  Write a generic keylistener?  I thought you already had one that and found it didn't work.  And I was confirming that what you found is correct, it doesn't work.

 

So as I said in my original post

"Given this restriction, is there any value in continuing to develop this application? "

 

Developer
Posts: 225
Registered: ‎09-29-2010
My Device: Limited Edition Z10, Playbook
My Carrier: Airtel

Re: Help needed for Background Application

Peter I am a little confused now

 

I am just trying to create an app with its own shortcut key (two keys combination)

As soon these keys are pressed a background process should run !!

 

I don't know how to create background listeners, what all is required n all

 

If key press could be captured by the background listener like in case of Key Loggers then I want to know how to create background listeners 

If not then there is nothing much I can do and I will try some other stuff on BB Smiley Wink

but I would still like to know how to create background processes that can sense any event in foreground.

 

Thanks

Abhinav Tyagi

 

 

Blackberry Z10-Limited Edition
Blackberry Playbook (won in free playbook offer)
My Apps : pAinT, HealthMeter, Shoot
Developer
Posts: 19,631
Registered: ‎07-14-2008
My Device: Not Specified

Re: Help needed for Background Application

"... As soon these keys are pressed a background process should run !!"

Is what I put previously not clear?

..it is not possible to have a background listener that will pick up general keys (like the letters and numbers) at any time.  In fact, the only keys for which this might be possible, some of the time and for some OS levels, are the 'special keys', like the Red phone key.

 

"I don't know how to create background listeners, what all is required n all"

Try this KB article

http://supportforums.blackberry.com/t5/Java-Development/Create-a-Background-Application/ta-p/445226

 

"If key press could be captured by the background listener like in case of Key Loggers..."

It can't.  It is not possible to create a Key Logger for a BlackBerry device.

 

"If not then there is nothing much I can do and I will try some other stuff on BB"

Please do

 

" I would still like to know how to create background processes that can sense any event in foreground."

You can't write such a background application that can sense any foreground event on the Blackberry.