@Test public void requestLocationUpdatesOutdoors() { LocationEngineRequest request = new LocationEngineRequest.Builder(10) .setPriority(LocationEngineRequest.PRIORITY_HIGH_ACCURACY).build(); LocationEngineCallback<LocationEngineResult> callback = mock(LocationEngineCallback.class); Looper looper = mock(Looper.class); when(locationManagerMock.getBestProvider(any(Criteria.class), anyBoolean())).thenReturn("gps"); engine.requestLocationUpdates(request, callback, looper); verify(locationManagerMock, times(2)).requestLocationUpdates(anyString(), anyLong(), anyFloat(), any(LocationListener.class), any(Looper.class)); }
@SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) { try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), request.getDisplacement(), listener, looper); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } } }
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) { try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), request.getDisplacement(), listener, looper); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } } } }
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) { try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), request.getDisplacement(), listener, looper); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } } } MapboxFusedLocationEngineImpl(@NonNull Context context); }
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) { try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), request.getDisplacement(), listener, looper); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } } } MapboxFusedLocationEngineImpl(@NonNull Context context); @NonNull @Override LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback); @Override void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull LocationListener listener,
                                     @Nullable Looper looper); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull PendingIntent pendingIntent); }
MapboxFusedLocationEngineImpl extends AndroidLocationEngineImpl { @SuppressLint("MissingPermission") @Override public void requestLocationUpdates(@NonNull LocationEngineRequest request, @NonNull LocationListener listener, @Nullable Looper looper) throws SecurityException { super.requestLocationUpdates(request, listener, looper); if (shouldStartNetworkProvider(request.getPriority())) { try { locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, request.getInterval(), request.getDisplacement(), listener, looper); } catch (IllegalArgumentException iae) { iae.printStackTrace(); } } } MapboxFusedLocationEngineImpl(@NonNull Context context); @NonNull @Override LocationListener createListener(LocationEngineCallback<LocationEngineResult> callback); @Override void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull LocationListener listener,
                                     @Nullable Looper looper); @SuppressLint("MissingPermission") @Override void requestLocationUpdates(@NonNull LocationEngineRequest request,
                                     @NonNull PendingIntent pendingIntent);  }