RMD wrote:
> Thanks for all the responses. I'm embarrassed to admit, but I had the
> GPS turned off in the phone. Since,
>
> locm.requestLocationUpdates("gps", 0, 0,onLocationChange);
>
> was specifically set to "gps" it wouldn't work.
>
> To address that I have it check if the gps is on and use network if
> the gps is disabled.
>
> LocationManager locm = (LocationManager)
> getSystemService(Context.LOCATION_SERVICE);
> //Check if GPS is enabled and choose network if it isn't
> if ( !locm.isProviderEnabled( LocationManager.GPS_PROVIDER ) ) {
> locm.requestLocationUpdates("network", 0, 0,onLocationChange);
> } else {
> locm.requestLocationUpdates("gps", 0, 0,onLocationChange);
> }
>
Another suggestion: don't use "network" and "gps", but use
LocationManager.NETWORK_PROVIDER and LocationManager.GPS_PROVIDER instead.
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy
Android Training in NYC: 30 April-2 May 2010: http://guruloft.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
To unsubscribe, reply using "remove me" as the subject.