BearND has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/183534

Change subject: Catch SecurityException when requesting location
......................................................................

Catch SecurityException when requesting location

Bug: T86198
Change-Id: Iafee01561e9cca830efb17ff3daa17b0c2333d0d
---
M wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
1 file changed, 14 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/apps/android/wikipedia 
refs/changes/34/183534/1

diff --git a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java 
b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
index 0100931..1d25624 100644
--- a/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
+++ b/wikipedia/src/main/java/org/wikipedia/nearby/NearbyFragment.java
@@ -284,12 +284,22 @@
     private void requestLocationUpdates() {
         boolean atLeastOneEnabled = false;
         if 
(locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) {
-            requestLocation(LocationManager.NETWORK_PROVIDER);
-            atLeastOneEnabled = true;
+            try {
+                requestLocation(LocationManager.NETWORK_PROVIDER);
+                atLeastOneEnabled = true;
+            } catch (SecurityException e) {
+                Log.e("Wikipedia", "Could not request location from "
+                        + LocationManager.NETWORK_PROVIDER, e);
+            }
         }
         if (locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER)) {
-            requestLocation(LocationManager.GPS_PROVIDER);
-            atLeastOneEnabled = true;
+            try {
+                requestLocation(LocationManager.GPS_PROVIDER);
+                atLeastOneEnabled = true;
+            } catch (SecurityException e) {
+                Log.e("Wikipedia", "Could not request location from "
+                        + LocationManager.GPS_PROVIDER, e);
+            }
         }
         // if neither of the location providers are enabled, then give the 
user the option
         // to go to Settings, so that they enable Location in the actual OS.

-- 
To view, visit https://gerrit.wikimedia.org/r/183534
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iafee01561e9cca830efb17ff3daa17b0c2333d0d
Gerrit-PatchSet: 1
Gerrit-Project: apps/android/wikipedia
Gerrit-Branch: master
Gerrit-Owner: BearND <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to