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
Posts: 33
Registered: ‎04-25-2009
My Device: Not Specified

No GPS Fix - ProviderStateChanged not fired

[ Edited ]

Hi there,

currently I developing a gps application. Due the lack to simulate no GPS coverage on the Simulator I'm testing it directly on my Blackberry Device.

 

If there is a GPS fix the Application updates a LabelField with a Coordinate (for test purposes only)

But if I use my Application indoors no GPS Fix is received. So the "The Waiting for GPS" Text is shown forever

because it seems that ProviderStateChanged Event is never fired.

 

On the Simulator a coordinate is received and the Waiting Text disappears, too.

 

Any Ideas?

 

Thanks,

hhessel 

 

P.S: JDE Component Package 4.7

 

Setup of GPS

_locationProvider.setLocationListener(new LocationListenerImpl(), 5, 1, 1);

 

The GPS Listener

// Implements LocationListener
private class LocationListenerImpl implements LocationListener
{

public void locationUpdated(LocationProvider provider, Location location)
{
if(location.isValid())
{
addToConsole("Location update");
WaitingForGPSThread.stop();
EnterpriseUnits.this.updateStatus("" + location.getQualifiedCoordinates().getLatitude());
}
}

public void providerStateChanged(LocationProvider provider, int newState)
{
addToConsole("Provider State changed");
WaitingForGPSThread.stop();
switch (newState)
{
case LocationProvider.OUT_OF_SERVICE:
EnterpriseUnits.this.updateStatus("GPS Out of service");
break;
case LocationProvider.TEMPORARILY_UNAVAILABLE:
EnterpriseUnits.this.updateStatus("GPS Temporarily unavailable");
break;
default:
EnterpriseUnits.this.updateStatus("GPS Error");
break;
}
}
}

 And a Thread that Display a Waiting Text 

// Waiting (Points Etc)
public class WaitingTextClass extends Thread
{
private boolean _active = true;
public void run()
{
while(_active)
{
if(_active)
{
EnterpriseUnits.this.updateStatus("Waiting for GPS .");
try
{
Thread.sleep(1000);
} catch(InterruptedException ex)
{}
}
if(_active)
{
EnterpriseUnits.this.updateStatus("Waiting for GPS ..");
try
{
Thread.sleep(1000);
} catch(InterruptedException ex)
{}
}
if(_active)
{
EnterpriseUnits.this.updateStatus("Waiting for GPS ...");
try
{
Thread.sleep(1000);
} catch(InterruptedException ex)
{}
}
}
}
private synchronized void stop()
{
_active = false;
}
private synchronized void restart()
{
_active = true;
}
}

  Full Application Code Pastit

Message Edited by hhessel on 04-25-2009 08:30 AM
BlackBerry Development Advisor
Posts: 15,113
Registered: ‎07-09-2008
My Device: BlackBerry Passport
My Carrier: Bell

Re: No GPS Fix - ProviderStateChanged not fired

You may need to go outside to receive a GPS fix.  Autonomous GPS mode requires a line of sight to the sky.  You can view the GPS mode supported by your BlackBerry handheld here:

 

What Is - The BlackBerry smartphone models and their corresponding GPS capabilities
Article Number: DB-00615

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

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
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook
My Carrier: E-Plus

Re: No GPS Fix - ProviderStateChanged not fired

I have never seen that providerStateChanged get fired on my 9700 OS 4.6.1.310 after lost of the GPS signal

 

See also http://supportforums.blackberry.com/t5/Java-Development/When-to-reset-a-LocationProvider/m-p/21908 : "In some handheld software versions it was reported that the TEMPORARILY_UNAVAILABLE state was not always triggered as appropriate."

Klaus Nahr
Developer
Posts: 55
Registered: ‎07-21-2009
My Device: Bold 9700 - 6.0 Bundle 1202 (v6.0.0.344, Platform 6.6.0.50)
My Carrier: Orange UK

Re: No GPS Fix - ProviderStateChanged not fired

Klaus,

 

Did you ever see the providerStateChanged  fire?

 

Having the same problem!

 

Thanks

"It's all about quality (of posts) not quantity"
Developer
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook
My Carrier: E-Plus

Re: No GPS Fix - ProviderStateChanged not fired

I never have seen a providerStateChanged event in my life.

 

The BlackBerry Smartphone will switch of the GPS Receiver after 3 unsuccessful scans for satellites. But you app does not get informed about that and after this, you will never get any location information, regardless if their is satellite coverage or not because the GPS receiver remains off. The receiver will be switched on when you go to Options - Advanced Options - GPS and start a search. Now you app will get the location too.

 

So what i am doing is, after 10 minutes without a valid location i do a setLocationListener(..). This will wake up the GPS receiver in case he was switched off. By do this the receiver remains on all the time. This will decreases battery life.

Klaus Nahr
Developer
Posts: 55
Registered: ‎07-21-2009
My Device: Bold 9700 - 6.0 Bundle 1202 (v6.0.0.344, Platform 6.6.0.50)
My Carrier: Orange UK

Re: No GPS Fix - ProviderStateChanged not fired

Thanks for that.

 

Got a response from M. Sohm from RIM in one of my other posts;

 

http://supportforums.blackberry.com/t5/Java-Development/locationProvider-getLocation-re-creating/td-...


"There is an issue the providerStateChanged on the BlackBerry Bold 9700, which is logged in the Issue Tracker here:  https://www.blackberry.com/jira/browse/JAVAAPI-1011 "

 

It appears to be a bug.

 

"It's all about quality (of posts) not quantity"
Developer
Posts: 45
Registered: ‎07-29-2008
My Device: Z10 Red, 8900, PlayBook
My Carrier: E-Plus

Re: No GPS Fix - ProviderStateChanged not fired

I did my testing with a 8900. Same problem.

Klaus Nahr