I have had location updates working all day, but suddenly this has stopped. And I have not changed the code for this.
I am doing:
activity = this;
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
criteria.setAltitudeRequired(true);
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
List<String> providers = locationManager.getProviders(criteria, true);
for (String provider : providers) {
System.out.println(provider);
locationManager.requestLocationUpdates(provider, 0, 0, activity);
location = locationManager.getLastKnownLocation(provider);
if (location != null) {
this.onLocationChanged(location);
}
}
The only provider it prints out is remote_gps and the coordinates always comes back as 0.0.
Questioner noted that the problem "resolved itself" when he noticed his HTCOne had quite providing updates (but did not note whether he power cycled his paired phone or made some other action). See comments.