@Implements(value=android.location.LocationManager.class) public class ShadowLocationManager extends java.lang.Object
Constructor and Description |
---|
ShadowLocationManager() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
addGpsStatusListener(android.location.GpsStatus.Listener listener) |
protected java.util.List<java.lang.String> |
getAllProviders() |
protected java.lang.String |
getBestProvider(android.location.Criteria criteria,
boolean enabled) |
android.location.Criteria |
getLastBestProviderCriteria()
Gets the criteria value used in the last call to
getBestProvider(android.location.Criteria, boolean) . |
boolean |
getLastBestProviderEnabledOnly()
Gets the enabled value used in the last call to
getBestProvider(android.location.Criteria, boolean) |
protected android.location.Location |
getLastKnownLocation(java.lang.String provider) |
protected java.util.List<java.lang.String> |
getProviders(boolean enabledOnly) |
java.util.Collection<java.lang.String> |
getProvidersForListener(android.location.LocationListener listener) |
java.util.Map<android.app.PendingIntent,android.location.Criteria> |
getRequestLocationUdpateCriteriaPendingIntents() |
java.util.Map<android.app.PendingIntent,java.lang.String> |
getRequestLocationUdpateProviderPendingIntents() |
java.util.List<android.location.LocationListener> |
getRequestLocationUpdateListeners() |
boolean |
hasGpsStatusListener(android.location.GpsStatus.Listener listener) |
protected boolean |
isLocationEnabledForUser(android.os.UserHandle userHandle) |
protected boolean |
isProviderEnabled(java.lang.String provider) |
protected void |
removeGpsStatusListener(android.location.GpsStatus.Listener listener) |
protected void |
removeUpdates(android.location.LocationListener listener) |
protected void |
removeUpdates(android.app.PendingIntent pendingIntent) |
protected void |
requestLocationUpdates(long minTime,
float minDistance,
android.location.Criteria criteria,
android.app.PendingIntent pendingIntent) |
protected void |
requestLocationUpdates(java.lang.String provider,
long minTime,
float minDistance,
android.location.LocationListener listener) |
protected void |
requestLocationUpdates(java.lang.String provider,
long minTime,
float minDistance,
android.location.LocationListener listener,
android.os.Looper looper) |
protected void |
requestLocationUpdates(java.lang.String provider,
long minTime,
float minDistance,
android.app.PendingIntent pendingIntent) |
boolean |
setBestProvider(java.lang.String provider,
boolean enabled) |
boolean |
setBestProvider(java.lang.String provider,
boolean enabled,
java.util.List<android.location.Criteria> criteria)
Sets the value to return from
getBestProvider(android.location.Criteria, boolean) for the given provider |
void |
setLastKnownLocation(java.lang.String provider,
android.location.Location location)
Sets the value to return from
getLastKnownLocation(String) for the given provider |
protected void |
setLocationEnabledForUser(boolean enabled,
android.os.UserHandle userHandle) |
void |
setProviderEnabled(java.lang.String provider,
boolean isEnabled)
Sets the value to return from
isProviderEnabled(String) for the given provider |
void |
setProviderEnabled(java.lang.String provider,
boolean isEnabled,
java.util.List<android.location.Criteria> criteria) |
void |
simulateLocation(android.location.Location location) |
@Implementation protected boolean isProviderEnabled(java.lang.String provider)
@Implementation protected java.util.List<java.lang.String> getAllProviders()
public void setProviderEnabled(java.lang.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(java.lang.String provider, boolean isEnabled, java.util.List<android.location.Criteria> criteria)
@Implementation protected java.util.List<java.lang.String> getProviders(boolean enabledOnly)
@Implementation protected android.location.Location getLastKnownLocation(java.lang.String provider)
@Implementation protected boolean addGpsStatusListener(android.location.GpsStatus.Listener listener)
@Implementation protected void removeGpsStatusListener(android.location.GpsStatus.Listener listener)
@Implementation protected java.lang.String getBestProvider(android.location.Criteria criteria, boolean enabled)
@Implementation(minSdk=28) protected void setLocationEnabledForUser(boolean enabled, android.os.UserHandle userHandle)
@Implementation(minSdk=28) protected boolean isLocationEnabledForUser(android.os.UserHandle userHandle)
@Implementation protected void requestLocationUpdates(java.lang.String provider, long minTime, float minDistance, android.location.LocationListener listener)
@Implementation protected void requestLocationUpdates(java.lang.String provider, long minTime, float minDistance, android.location.LocationListener listener, android.os.Looper looper)
@Implementation protected void requestLocationUpdates(long minTime, float minDistance, android.location.Criteria criteria, android.app.PendingIntent pendingIntent)
@Implementation protected void requestLocationUpdates(java.lang.String provider, long minTime, float minDistance, android.app.PendingIntent pendingIntent)
@Implementation protected void removeUpdates(android.location.LocationListener listener)
@Implementation protected void removeUpdates(android.app.PendingIntent pendingIntent)
public boolean hasGpsStatusListener(android.location.GpsStatus.Listener listener)
public android.location.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(java.lang.String provider, boolean enabled, java.util.List<android.location.Criteria> criteria) throws java.lang.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 criteriajava.lang.Exception
- if provider is not knownpublic boolean setBestProvider(java.lang.String provider, boolean enabled) throws java.lang.Exception
java.lang.Exception
public void setLastKnownLocation(java.lang.String provider, android.location.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 java.util.List<android.location.LocationListener> getRequestLocationUpdateListeners()
public void simulateLocation(android.location.Location location)
public java.util.Map<android.app.PendingIntent,android.location.Criteria> getRequestLocationUdpateCriteriaPendingIntents()
public java.util.Map<android.app.PendingIntent,java.lang.String> getRequestLocationUdpateProviderPendingIntents()
public java.util.Collection<java.lang.String> getProvidersForListener(android.location.LocationListener listener)