Hi all..
i am working on an application that needs to find GPS location of the user. While testing my code on Droid i am unable to find the GPS location. While googling i found this link to an issue raised with Google.
But apps like Yelp can find the GPS location on droid. Is there a workaroud to find the user location on a device? Here's the code I am using
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationProvider;
import android.os.Bundle;
public class MyLocationListener implements LocationListener {
private static double latitude;
private static double longitude;
public static boolean gpsAvailable = false;
@Override
public void onLocationChanged(Location arg0) {
latitude = arg0.getLatitude();
longitude = arg0.getLongitude();
// Log.d("MyLocationListener", "onLocationChanged");
}
@Override
public void onProviderDisabled(String provider) {
// Log.d("MyLocationListener", "onProviderDisabled");
}
@Override
public void onProviderEnabled(String provider) {
// Log.d("MyLocationListener", "onProviderEnabled");
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
// Log.d("MyLocationListener", "onStatusChanged called");
if (provider.equals("gps") && status != LocationProvider.AVAILABLE) {
gpsAvailable = false;
// Log.d("MyLocationListener", "status NOTAVAILABLE");
} else {
gpsAvailable = true;
// Log.d("MyLocationListener", "status AVAILABLE");
}
}
public static double getLatitude() {
return latitude;
}
public static double getLongitude() {
return longitude;
}
}
thanks..