Saturday, November 12, 2011

[android-developers] Location - GPS/Network

Hi

I'm trying to take the current location using GPS or Network which ever is connected. The following code works fine to me if my mobile connected with WiFi or GPS turned ON. But if both of them turned ON/Connected then it doesnt give me any result

locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 0, new GeoUpdateHandler());  

Location location = null; 
location = locationManager.getLastKnownLocation(provider); 
if (location == null)
{
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 200, 0, new GeoUpdateHandler());
location = locationManager.getLastKnownLocation(provider);
}


Always Im getting "location" NULL if both off them connected.

What is wrong here ?

Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment