08-07-2010 03:25 PM
In this thread MSohm says "The GPS Services option does not toggle GPS on or off". This means that if a device has a built-in GPS receiver, then the code like this
LocationProvider provider = LocationProvider.getInstance(null);
should never return null regardless of GPS Services option.
But if I try the above code on both Curve 8310 (4.5.0) and Storm 9530 (4.7.0) simulators (both have a built-in GPS receiver), then i get null if GPS Services option is set to Location OFF. If I change GPS Services option to Location ON, then I get a non-null LocationProvider and I am able then to get locatoin, etc.
Is this a bug of simulators? Can anyone say how this would work on real device?
08-11-2010 04:06 PM
I just got the results of testing on real device (Storm).
Surprisingly, real device behaviour is the same I got on simulator.
I am confused. MSohm said "The GPS Services option does not toggle GPS on or off", but it DOES toggle GPS on/off !
Could anyone give any comments?
Just in case - we are talking about 'Options' > 'Andvanced Options' > 'GPS' > 'GPS Services' > 'Location Off/On'.
12-17-2010 04:32 AM
I am also facing the same problem. In my application I want to check
1) if the device has GPS
2) if the GPS is turned off
But in both the cases the LocationProvider object is null. And hence there is no way to find the getState(). I got the same result on different simulators running on OS 4.5 and above, and on 8520, 9530 devices as well.
If the GPS is turned On, then I am able to get location info.
Can somebody tell me how to check if the device supports GPS or not.