OSDN Git Service

ignore any exception in requestLocationUpdates
[android-x86/frameworks-base.git] / location / java / android / location / LocationManager.java
index 9027fc2..b831e60 100644 (file)
@@ -81,6 +81,19 @@ public class LocationManager {
     public static final String GPS_PROVIDER = "gps";
 
     /**
+     * A special location provider for receiving locations without actually initiating
+     * a location fix. This provider can be used to passively receive location updates
+     * when other applications or services request them without actually requesting
+     * the locations yourself.  This provider will return locations generated by other
+     * providers.  You can query the {@link Location#getProvider()} method to determine
+     * the origin of the location update.
+     *
+     * Requires the permission android.permission.ACCESS_FINE_LOCATION, although if the GPS
+     * is not enabled this provider might only return coarse fixes.
+     */
+    public static final String PASSIVE_PROVIDER = "passive";
+
+    /**
      * Key used for the Bundle extra holding a boolean indicating whether
      * a proximity alert is entering (true) or exiting (false)..
      */
@@ -304,7 +317,7 @@ public class LocationManager {
         List<String> providers = getProviders(enabledOnly);
         for (String providerName : providers) {
             LocationProvider provider = getProvider(providerName);
-            if (provider.meetsCriteria(criteria)) {
+            if (provider != null && provider.meetsCriteria(criteria)) {
                 if (goodProviders.isEmpty()) {
                     goodProviders = new ArrayList<String>();
                 }
@@ -697,7 +710,7 @@ public class LocationManager {
                 mListeners.put(listener, transport);
                 mService.requestLocationUpdates(provider, minTime, minDistance, transport);
             }
-        } catch (RemoteException ex) {
+        } catch (Exception ex) {
             Log.e(TAG, "requestLocationUpdates: DeadObjectException", ex);
         }
     }