Permalink
Browse files

Fix a java exception around the GPS stuff

  • Loading branch information...
hrydgard committed Nov 29, 2017
1 parent b522852 commit b0c42f708199a3b02837fcc015ffb456fec6865f
Showing with 5 additions and 4 deletions.
  1. +5 −4 android/src/org/ppsspp/ppsspp/LocationHelper.java
@@ -20,17 +20,18 @@
void startLocationUpdates() {
Log.d(TAG, "startLocationUpdates");
if (!mLocationEnable) {
boolean isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
boolean isNetworkEnabled = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
boolean isGPSEnabled = false;
boolean isNetworkEnabled = false;
try {
isGPSEnabled = mLocationManager.isProviderEnabled(LocationManager.GPS_PROVIDER);
isNetworkEnabled = mLocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
mLocationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, this);
mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 1000, 0, this);
mLocationEnable = true;
} catch (SecurityException e) {
Log.e(TAG, "Cannot start location updates: " + e.toString());
}
if(!isGPSEnabled && !isNetworkEnabled) {
if (!isGPSEnabled && !isNetworkEnabled) {
Log.i(TAG, "No location provider found");
// TODO: notify user
}

0 comments on commit b0c42f7

Please sign in to comment.