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: 21
Registered: ‎03-30-2012
My Device: os6
My Carrier: 9780
Accepted Solution

Session.waitForDefaultSession().getStore() is null

in the blackberry Simulator anyting is ok ,but when i put in my blackberry device is null;

 

 

this code is in a Application,which is Auto-run startup,when i debug in my device ,find is null ,

but  i make a new apps , set it in a Uiapplication Screen , everything is well,

i do the why

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

Re: Session.waitForDefaultSession().getStore() is null

Does the device have a BlackBerry plan and is it setup with an email address?

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Session.waitForDefaultSession().getStore() is null

consider adding this code in your autostart entry point:

ApplicationManager app = ApplicationManager.getApplicationManager();
	while (app.inStartup()) {
		try {
			Thread.sleep(400);
		} catch (InterruptedException e) {
	}
}

 

 

----------------------------------------------------------
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: 21
Registered: ‎03-30-2012
My Device: os6
My Carrier: 9780

Re: Session.waitForDefaultSession().getStore() is null

no BlackBerry plan
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Session.waitForDefaultSession().getStore() is null

"no BlackBerry plan "

That will probably explain the null.

 

Anyway, you should not test things like that in startup until the device is fully up.  Simon has provided on bit of code to do that.  Personally I prefer the approach shown in this KB article, though it is a little more complicated:

http://supportforums.blackberry.com/t5/Java-Development/Write-safe-initialization-code/ta-p/444795

 

Once you get past start-up, then you should allow the processing to cope with getting a null default session if you want to test on devices without BlackBerry plans. 

 

I think these two points together should solve your problem.