Closed davcpas1234 closed 5 years ago
After investigation, this issue cannot be replicated on any simulated devices, but is reflected on all live devices.
New Implementation:
[...]
if(context != null) {
locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE);
locationListener = new LocationListener() {
@Override
public void onLocationChanged(Location location) {
if(locationProgress != null) {
locationProgress.dismiss();
}
mLocation = location;
Log.d("Location Changes", location.toString());
setTemperatureValue(mLocation);
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
Log.d("Status Changed", String.valueOf(status));
}
@Override
public void onProviderEnabled(String provider) {
Log.d("Provider Enabled", provider);
}
@Override
public void onProviderDisabled(String provider) {
Log.d("Provider Disabled", provider);
}
};
criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_COARSE);
criteria.setPowerRequirement(Criteria.POWER_LOW);
criteria.setAltitudeRequired(false);
criteria.setBearingRequired(false);
criteria.setSpeedRequired(false);
criteria.setCostAllowed(false);
criteria.setHorizontalAccuracy(Criteria.ACCURACY_HIGH);
criteria.setVerticalAccuracy(Criteria.ACCURACY_HIGH);
mLooper = null;
}
[...]
int coarseLocationPermission = PermissionChecker.checkSelfPermission(context, Manifest.permission.ACCESS_COARSE_LOCATION);
int fineLocationPermission = PermissionChecker.checkSelfPermission(context, Manifest.permission.ACCESS_FINE_LOCATION);
if (coarseLocationPermission == PermissionChecker.PERMISSION_GRANTED && fineLocationPermission == PermissionChecker.PERMISSION_GRANTED) {
locationManager.requestSingleUpdate(criteria, locationListener, mLooper);
} else {
((MainActivity) getActivity()).createAndCheckPermissions();
}
[...]
New implementation has been successful in testing:
This will be released as part of v0.0.6-rc4
Application Version
0.0.5
Issue Description
When retrieving location, the application hangs on "Getting Location..." and doesn't propagate past this. The only way to exit is user interaction.
Steps to Reproduce
Expected Behaviour
Location is retrieved and weather API call is performed, temperature is retrieved.