diff --git a/library/src/main/java/io/nlopez/smartlocation/location/providers/LocationManagerProvider.java b/library/src/main/java/io/nlopez/smartlocation/location/providers/LocationManagerProvider.java index 75567a5a..194b4025 100644 --- a/library/src/main/java/io/nlopez/smartlocation/location/providers/LocationManagerProvider.java +++ b/library/src/main/java/io/nlopez/smartlocation/location/providers/LocationManagerProvider.java @@ -62,8 +62,17 @@ public void start(OnLocationUpdatedListener listener, LocationParams params, boo } locationManager.requestSingleUpdate(criteria, this, Looper.getMainLooper()); } else { + String provider = locationManager.getBestProvider(criteria, true); + if (provider == null) { + logger.e("No provider found for criteria %s", criteria.toString()); + return; + } locationManager.requestLocationUpdates( - params.getInterval(), params.getDistance(), criteria, this, Looper.getMainLooper()); + provider, + params.getInterval(), + params.getDistance(), + this, Looper.getMainLooper() + ); } }