LocationManager lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
List<String> providers = lm.getProviders(true);
System.out.println("providers size"+providers.size());
for(int i=0;i<providers.size();i++){
System.out.println("providers "+providers.get(i));
}
Location l = null;
for (int i=providers.size()-1; i>=0; i--) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null) break;
}
double[] gps = new double[2];
if (l != null) {
gps[0] = l.getLatitude();
gps[1] = l.getLongitude();
lat2=gps[0];
lng2=gps[1];
List<String> providers = lm.getProviders(true);
System.out.println("providers size"+providers.size());
for(int i=0;i<providers.size();i++){
System.out.println("providers "+providers.get(i));
}
Location l = null;
for (int i=providers.size()-1; i>=0; i--) {
l = lm.getLastKnownLocation(providers.get(i));
if (l != null) break;
}
double[] gps = new double[2];
if (l != null) {
gps[0] = l.getLatitude();
gps[1] = l.getLongitude();
lat2=gps[0];
lng2=gps[1];
No comments:
Post a Comment