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

Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.

New Developer
Posts: 13
Registered: ‎03-24-2014
My Device: Developer Bold 9700
My Carrier: Vodafone

App closes after some time (randomly)

[ Edited ]

Dear BB Developers,

I am trying to develope an application and i can call myself as a total newbie. (i am familiar with PHP only)

Application purpose is that notifying my server via HTTP when my BB receive a call. (its working over Wi-Fi)

Actually, app is working fine. HTTP is working too! I am using it since 5-6 months.

But there some issues with it.

I am looking for any help to resolve this issues.


Device: Blackberry 9700 and 9000

Enviroment: Eclipse Blackberry 6.0


- Application closes by itself after some time, its working for 2 days or 3 days.

- Application doesn't have any GUI, so i have to check my "running apps" from Application Manager, also it doesnt have any icon on "active applications"

- I've coded this by using free libraries and codes from various sources. Barely working but its working! Smiley Happy


My questions are

- How can i fix the whole issue? Why application is crashes?

- Is that possible to run my application on startup? (soft reset or battery off reset)


My code is at https://www.sendspace.com/file/1wh7kd


Thank you all!

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

Re: App closes after some time (randomly)

Not looked at your code sorry, busy elsewhere.


Note that I was not aware that BB 9000 ran OS 6.0. 


When your application stops, it will almost certianly have written some information regarding the failure to the device's log, which you can find using ALT LGLG.  But quite a lot of stuff goes there, so you might struggle to find it. 


I suggest you add some logging to your application, so you can tell what it was doing, at least just before it stopped.  That should give you some clues as to the problem.  Possibly the easiest thing to do, at least while you are tracking down this problem, is to write to an SD Card, then you can check the SD Card when you see your application has failed, to determine what it was doing just before it failed.


the processing you are describing is normally handled in a call listener.  In that listener processing, I am hoping that you issue a Global Event to notify your application regarding the call an the http processing is handled in your application. 


In answer to your questions:


"How can i fix the whole issue? Why application is crashes?"

We can not tell from the information presented.  You will invstigate this fruther yourself.


"Is that possible to run my application on startup? (soft reset or battery off reset)"

The hard reset situation is covered in many Threads on this forum, so search for this, perhaps using the term auto start.  For the soft restart, investigate SystemListener class.


You may consider having a second application that monitors the failing one.  This is not too complicated to set up - look at ApplicationManager methods to help you with this. 


You will need an alternate entry to do this: 


New Developer
Posts: 13
Registered: ‎03-24-2014
My Device: Developer Bold 9700
My Carrier: Vodafone

Re: App closes after some time (randomly)

Hello Peter,

Sorry for the confusion. I have multiple devices and my app is just working on 9700 so you can ignore 9000.
Yeah, i was trying to find a log with ALT LGLG but it's difficult as you stated.

I am going to log my application as you suggested, to SD card.
Which method/function needed for this?

Also, i'll try auto-start with SystemListener later.

It would be great if you can take a look to my code when you are free.
Thanks in advance.

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

Re: App closes after some time (randomly)

Logging to the SD Card would be done using the FileConnection API.  There are many Threads on this and samples around so have a look for it. 


Not sure when I will be able to look at your code, but it won't be today.  Hopefully someone else can have a look. 

New Developer
Posts: 13
Registered: ‎03-24-2014
My Device: Developer Bold 9700
My Carrier: Vodafone

Re: App closes after some time (randomly)

Dear Peter,

Thanks for help.

I've found some examples to write on SD Card. So i'll go for it.

But may you enlighten me about things to write to file?

I mean, should i write to file on try/catch block?


And one last thing.

Should i keep a "Thread.sleep" under callIncoming?

How does affects my app?

Somehow, i've disabled it earlier but i can't remember why Smiley Happy

Thank you!


	public void callIncoming(int callId) {
	final PhoneCall call = Phone.getCall(callId);  
final String number = call.getDisplayPhoneNumber(); new ConnectionThread().run(number, "call"); /* this runs http connection */ /* try { Thread.sleep(1000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } */ }


New Developer
Posts: 13
Registered: ‎03-24-2014
My Device: Developer Bold 9700
My Carrier: Vodafone

Re: App closes after some time (randomly)



Just a quick note.

I've read something on BB forums, it was probably your message.

And it was about, killing Phone process on BB.

I think it's my problem on my app.

My app kills Phone process somehow and even my phone rings, i can't see any notification popup/window or something (just LED indicator) then after 5-6 mins, "missed calls" popup comes.


Bottomline is that my app is killing Phone process! (sounds lame, i know)

Is that possible to recover Phone process on BB?

Of course, i should fix the my killer app but i would like to learn if its possible to restart Phone process, because i am struggling this when i testing/debugging my app.

Posts: 17,025
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: App closes after some time (randomly)

The issue at hand is that you use Thread.sleep in the phone listener.
The listener runs in the context of the phone application, and sleep blocks both the listener and its context.
This causes a system watchdog to terminate it. It gets restarted automatically, but your listener does not.

Another potential issue is you using run() on your ConnectionThread. The correct method to launch a thread is start().

What i would suggest you to do is to move all processing out of the phone listener by just emitting a global event there.
Receive the global event in your application and trigger the processing there. The other points are still valid though, don't use sleep on the event thread and start the thread correctly.
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