mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix a java exception around the GPS stuff
This commit is contained in:
parent
b52285287d
commit
b0c42f7081
1 changed files with 5 additions and 4 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue