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
timnelson
Posts: 102
Registered: ‎07-15-2008
My Device: Not Specified

How to handle when JSR179 (bluetooth GPS) moves out of range or off...

I've got a GPS tracking app (BB8100-GlobalSat BT386i) working fine as long as the bluetooth GPS is in range and is on. I have a timertask that wakes up, creates a location provider and gets a location.  Works great until I move the phone out of range or turn the GPS unit off.  From then on the getLocation just throws a timeout exception every time the timertask wakes up and calls it, even when I am back in range or the unit is turned on again.  I can exit and restart the application but that (of course) isn't a workable solution.

 

Has anyone else run into this issue and solved it?

Retired
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

When the Bluetooth GPS receiver goes out of range, it should fire the exact same events as would be fired when you lose the ability to get a GPS fix, and the steps to recover should be the same as well.  Please see the below KB article for more details:

 

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800703/How_To_...

 

In addition to notifying you of GPS availability, a LocationListener can also manage the functionality you currently have defined in your TimerTask (i.e. retrieval of GPS fixes at regular intervals).

 

 

Brian Zubert
Technical Partnership Manager
Research In Motion
Developer
timnelson
Posts: 102
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

Are you implying then, if I use a TimerTask the problem of going out of range can not be solved and I have to use a LocationListener?
Retired
bzubert
Posts: 86
Registered: ‎07-11-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

The LocationListener will need to be used for detecting the TEMPORARILY_UNAVAILABLE event.  If the GPS receiver comes back into range, once you reset the LocationProvider, fixes should resume, regardless of the mechanism used (getLocation() in a TimerTask or LocationListener.locationUpdated()).  I was simply suggesting that the LocationListener could serve two purposes: 1) for detecting the unavailable event, 2) for defining receiving GPS updates.

Brian Zubert
Technical Partnership Manager
Research In Motion
Developer
timnelson
Posts: 102
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

Well then I think we have a problem.  No matter how I try to solve the out of range issue, the bluetooth never seems to reconnect.   In my TimerTask version I always create a new location provider and no matter what happens once it's out of range and then I come back in range, the location provider times out forever after that.   I also changed the GPS demo you have as a sample to do what your document said reset on the location provider, null the listener, register a new listener when the provider state changes and provider forever stays out of service/unavaliable.  I think this issue has been reported in the past and I've seen it on a number of forums on certain OS versions (I have BB8100-GlobalSAT BT386i OS 4.2.1.96).  Please give me a fix or a workaround.

 

A forum post describing this:   http://www.blackberry.com/developers/forum/thread.jsp?forum=1&thread=11295&message=45392&q=bluetooth...

BlackBerry Development Advisor
MSohm
Posts: 14,753
Registered: ‎07-09-2008
My Device: BlackBerry Passport

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

Have you tried BlackBerry handheld software version 4.5.0?  If so, are you seeing the same behaviour there?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
timnelson
Posts: 102
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

I would try a newer version, but I have no idea where to download it from.   AT+T only has 4.2.X downloads for the 8100.

 

Developer
timnelson
Posts: 102
Registered: ‎07-15-2008
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

Ok, I chased down a beta version of 4.5.0 and the scenario changes once again:

 

1. The application that uses the TimerTask and instantiates a LocationProvider each time seems to be able to recover from the bluetooth GPS being turned off or out of range.  When it comes back in range everything starts up again.

 

2.  The LocationListener version is working worse now.  It never seens to get a provider state changed (which I was getting with 4.2.1.96) which won't allow the code to to reset() and reinstall a new listener, so once it's out of range it stops getting fixes forever.

 

On the bright side, I have never hung to the point of having to remove the battery like I did on 4.2.1.96 to do a hard reset.

 

Surely I can't be the only **bleep** stunnling across these issues...

Developer
Developer
mb1
Posts: 320
Registered: ‎05-26-2009
My Device: Not Specified

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

Hi,

 

Were you able to work around bluetooth GPS moving out of range for OS versions 4.2.1.X.

I am not able to reconnect to bluetooth GPS once it goes out of range /disconnected.

Resetting the provider and setting a new listener is having no effect.

 

--MB. 

Developer
KlausNahr
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook

Re: How to handle when JSR179 (bluetooth GPS) moves out of range or off...

I had the same problem with Bluetooth GPS Receivers. Once the connection to a Bluetooth GPS receiver got lost, i could not get GPS fixes after reestablishing of the Bluetooth connection. I found only one solution: When i detect the lost of the connection i terminate my app and restart the app 2 minutes later. That worked for me. But maybe confuses the user.

 

public static boolean restart(int minutes) {
    ApplicationDescriptor apDes = ApplicationDescriptor.currentApplicationDescriptor();
    boolean result = ApplicationManager.getApplicationManager().scheduleApplication(apDes, System.currentTimeMillis() + 60000 * minutes, true);
   return result;

 }

Klaus Nahr