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: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800
Accepted Solution

Running Background thread(sms listening thread) connected to the GUI app(alternate entry point)

Hi, I am new to Blackberry development,  I have read all about application running on startup and having an alternate entry point for that application. Still i need help with my application

 

i am using BB JDE 4.7

simulator : BB 9530 4.7.0

 

I am developing an SMS application. (extends UiApplication)

1) It has a thread which listens to incoming messages

2) It has a thread which is a SMS sender

3) it has one main screen and two full screens. so when the user clicks a button in any of the full screens.. i am sending a message

4) When a message is received , based on the message content i am pushing either of the one full screen

5) I have, all the threads and screens as the inner class of the main class extending the UiApplication.

 

I have succeeded the basic functionality. I need help in making the application as the autostartup application

1) i need to start the sms listener thread when the BB phone starts up

2) i need to have the application icon in the applications screen as the alternate entry point for the application (only for GUI) and still the listener thread should be active in the background.

3) when an incoming message is detected, the GUI application should be brought to the foreground(if its not already forground) after displaying a popup (instead of bringing the application to the foreground, is it better to display a flashing icon in the status bar of the blackberry home screen and may be global popup)

4) when the GUI part of the application is closed, i need to stop the sms sending thread, and when the system shuts down i need to stop the listening thread.

 

Please help me out guys.... I have read lots of articles and discussions regarding autostart up applications, alternate entry point, background threads...

but i couldn't conclude how to implement my requirements.

1) Should i need to create two different projects(applications, one for [GUI and sender thread] and one for listener thread)? or i can achieve this by single application?

2)  Should i need to connect the background thread to the GUI app? If yes, how to do so?

3) Is it necessary to use the RunTimeStore object? if yes, i am not sure how i can bring the GUI app foreground from the background thread.

4) If i have to stop the listener thread by overiding onExit() method, the major doubt i have is ,Whether onExit() method is only for applications extending Application class and not for the UiApplication class?

5) If i should have two projects (one as main and other as alternate point entry), which project i should make as 'autorun on startup' and as a 'system module'.

           

As i need to have the background thread still running when the GUI app is active. I am not sure how i should proceed.

Developer
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Re: Running Background thread(sms listening thread) connected to the GUI app(alternate entry point)

Hi everyone..

I have achieved my requirements through single application. I used one alternate entry point.

 

For reference chk my other post

http://supportforums.blackberry.com/t5/Java-Development/How-to-avoid-creating-two-instances-of-the-a...

Trusted Contributor
Posts: 126
Registered: ‎10-15-2010
My Device: Torch 9850
My Carrier: Not specified

Re: Running Background thread(sms listening thread) connected to the GUI app(alternate entry point)

hi friend

I'm too having background process task to make the thread runs continously until the syystem is shut down. So,

can u pls explain me how to achieved the background process in single application.

also if u can send me the snippet of codings to understand myself.

Developer
Posts: 38
Registered: ‎10-27-2010
My Device: Blackberry Torch 9800

Re: Running Background thread(sms listening thread) connected to the GUI app(alternate entry point)

Hi Gopi,

Tell me exactly what you are trying to achieve through your code, so tat i can help you better.

 

You can start a new thread for your query.

 

Hope you have checked the link in my previous message in this topic.

Highlighted
New Developer
Posts: 10
Registered: ‎12-15-2010
My Device: blackberry bold
My Carrier: s/w developer

Re: Running Background thread(sms listening thread) connected to the GUI app(alternate entry point)

hi 

i want to  schedule a message and its  sending time  ,now i want  t o automatically send the sms  .i think it needs a  background thread ,  can u  help me  ,im  beginner