@Test(expected = NullPointerException.class) public void getLastLocationNullCallback() { engine.getLastLocation(null); }
@Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locationManager.getAllProviders()) { lastLocation = getLastLocationFor(provider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } } callback.onFailure(new Exception("Last location unavailable")); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locationManager.getAllProviders()) { lastLocation = getLastLocationFor(provider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } } callback.onFailure(new Exception("Last location unavailable")); } }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locationManager.getAllProviders()) { lastLocation = getLastLocationFor(provider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } } callback.onFailure(new Exception("Last location unavailable")); } AndroidLocationEngineImpl(@NonNull Context context); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locationManager.getAllProviders()) { lastLocation = getLastLocationFor(provider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } } callback.onFailure(new Exception("Last location unavailable")); } AndroidLocationEngineImpl(@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); @SuppressLint("MissingPermission") @Override void removeLocationUpdates(@NonNull LocationListener listener); @Override void removeLocationUpdates(PendingIntent pendingIntent); }
AndroidLocationEngineImpl implements LocationEngineImpl<LocationListener> { @Override public void getLastLocation(@NonNull LocationEngineCallback<LocationEngineResult> callback) throws SecurityException { Location lastLocation = getLastLocationFor(currentProvider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } for (String provider : locationManager.getAllProviders()) { lastLocation = getLastLocationFor(provider); if (lastLocation != null) { callback.onSuccess(LocationEngineResult.create(lastLocation)); return; } } callback.onFailure(new Exception("Last location unavailable")); } AndroidLocationEngineImpl(@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); @SuppressLint("MissingPermission") @Override void removeLocationUpdates(@NonNull LocationListener listener); @Override void removeLocationUpdates(PendingIntent pendingIntent);  }