mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-17 16:30:30 +02:00
Fix a java exception around the GPS stuff
This commit is contained in:
1 parent
b52285287d
commit
b0c42f7081
1 file changed
+5
-4
@@ -20,17 +20,18 @@ class LocationHelper implements LocationListener {
|
||||
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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user