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


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.


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

LocationProvider and Auto-On/Off

[ Edited ]
I have an application that transmits locations.
If i switch the BB off and turn it on again the location provider is not delivering data any more, the methods are run but without any output.

How can we get our application to retrieve locations again after switching the device off and on?
(tested on 4.2.1 and 4.5)
Message Edited by simon_hain on 08-05-2008 04:21 PM
----------------------------------------------------------
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
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: LocationProvider and switching device on and off

Not seen this problem, we have applications using LocationListener that stop and restart (using SystemListener methods) correctly during device restart on the levels of OS you are talking about.

 

How do you kick it back into life once this happens? 

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

Re: LocationProvider and switching device on and off

it seems that it is not the normal off/on process but the auto on/off that puts the BB into something like standby.
if our application is up and running when the device switches itself (auto)off it is still running when the device comes online at the scheduled time.

i was not aware of this feature and it seems that i will have to restart certain threads and timers.

does systemlistener.powerup fire when the device comes online again from the auto-off?
----------------------------------------------------------
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
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: LocationProvider and switching device on and off

Just had a quick look at the code, and can't quickly figure what it is doing, sorry, but I think the theory is as follows:

1) Your application is autostarted

2) On autostart, you add the app as a SystemListener.

3) Then you check to see if you are in the startup phase using ApplicationManager.inStartup().  If you are in startup you can't do any UI processing, so you may delay your startup till SystemListener powerUp() is called, otherwise you can do it straight away (the second case covers installation time).

4) You stop your threads etc. in SystemListener powerOff().

 

I believe I have had problems assuming the RuntimeStore would be cleared over a 'soft' power down and restart (such happens when you press the mute key), but adding a SystemListener as described above solved that.

 

What I can tell you, from my review of the code, is that it will find it has NOT had a valid GPS location for some time (because the device has been powered down) and this will cause it to stop and restart the Location Provider - it could be this stop and restart, rather than the handling of the powerOff and powerUp that provokes the recovery.

 

Hope this helps.