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
simon_hain
Posts: 16,190
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

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
Please use plain text.
Developer
peter_strange
Posts: 19,607
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? 

Please use plain text.
Developer
simon_hain
Posts: 16,190
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

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
Please use plain text.
Developer
peter_strange
Posts: 19,607
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.

Please use plain text.