@Implements(value=android.location.LocationManager.class) public class ShadowLocationManager extends Object
| Constructor and Description |
|---|
ShadowLocationManager() |
@Implementation protected boolean isProviderEnabled(String provider)
@Implementation protected List<String> getAllProviders()
public void setProviderEnabled(String provider, boolean isEnabled)
Sets the value to return from isProviderEnabled(String) for the given provider
provider - name of the provider whose status to setisEnabled - whether that provider should appear enabledpublic void setProviderEnabled(String provider, boolean isEnabled, List<Criteria> criteria)
@Implementation protected List<String> getProviders(boolean enabledOnly)
@Implementation protected Location getLastKnownLocation(String provider)
@Implementation protected boolean addGpsStatusListener(GpsStatus.Listener listener)
@Implementation protected void removeGpsStatusListener(GpsStatus.Listener listener)
@Implementation protected String getBestProvider(Criteria criteria, boolean enabled)
@Implementation(minSdk=28) protected void setLocationEnabledForUser(boolean enabled, UserHandle userHandle)
@Implementation(minSdk=28) protected boolean isLocationEnabledForUser(UserHandle userHandle)
@Implementation protected void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)
@Implementation protected void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener, Looper looper)
@Implementation protected void requestLocationUpdates(long minTime, float minDistance, Criteria criteria, PendingIntent pendingIntent)
@Implementation protected void requestLocationUpdates(String provider, long minTime, float minDistance, PendingIntent pendingIntent)
@Implementation protected void removeUpdates(LocationListener listener)
@Implementation protected void removeUpdates(PendingIntent pendingIntent)
public boolean hasGpsStatusListener(GpsStatus.Listener listener)
public Criteria getLastBestProviderCriteria()
Gets the criteria value used in the last call to getBestProvider(android.location.Criteria, boolean).
public boolean getLastBestProviderEnabledOnly()
Gets the enabled value used in the last call to getBestProvider(android.location.Criteria, boolean)
public boolean setBestProvider(String provider, boolean enabled, List<Criteria> criteria) throws Exception
Sets the value to return from getBestProvider(android.location.Criteria, boolean) for the given provider
provider - name of the provider who should be considered bestenabled - Enabledcriteria - List of criteriaException - if provider is not knownpublic boolean setBestProvider(String provider, boolean enabled) throws Exception
Exceptionpublic void setLastKnownLocation(String provider, Location location)
Sets the value to return from getLastKnownLocation(String) for the given provider
provider - name of the provider whose location to setlocation - the last known location for the providerpublic List<LocationListener> getRequestLocationUpdateListeners()
public void simulateLocation(Location location)
public Map<PendingIntent,Criteria> getRequestLocationUdpateCriteriaPendingIntents()
public Map<PendingIntent,String> getRequestLocationUdpateProviderPendingIntents()
public Collection<String> getProvidersForListener(LocationListener listener)