Class LocationCollector
- java.lang.Object
-
- org.forgerock.android.auth.collector.LocationCollector
-
- All Implemented Interfaces:
DeviceCollector,Interceptor<org.json.JSONObject>
public class LocationCollector extends java.lang.Object implements DeviceCollector
Collector to collect Last Known Location information, this collector will first try to useFusedLocationProviderClientto collect last location data, ifFusedLocationProviderClientclass not found or failed to retrieve the location, it fallbacks to Android framework Location API to retrieve the last known location. You may need to override this LocationCollector to collect more recent location.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.forgerock.android.auth.Interceptor
Interceptor.Chain
-
-
Field Summary
-
Fields inherited from interface org.forgerock.android.auth.collector.DeviceCollector
TAG
-
-
Constructor Summary
Constructors Constructor Description LocationCollector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcollect(android.content.Context context, FRListener<org.json.JSONObject> listener)Collect the device data.java.lang.StringgetName()Retrieve the name of the Collectorprotected org.json.JSONObjectresult(android.location.Location location)ConvertLocationtoJSONObject-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.forgerock.android.auth.collector.DeviceCollector
collect, intercept
-
-
-
-
Method Detail
-
getName
public java.lang.String getName()
Description copied from interface:DeviceCollectorRetrieve the name of the Collector- Specified by:
getNamein interfaceDeviceCollector- Returns:
- The name of the Collector
-
collect
public void collect(android.content.Context context, FRListener<org.json.JSONObject> listener)Description copied from interface:DeviceCollectorCollect the device data.- Specified by:
collectin interfaceDeviceCollector- Parameters:
context- The Application Contextlistener- Listener to listen for collected data.
-
result
protected org.json.JSONObject result(android.location.Location location)
ConvertLocationtoJSONObject- Parameters:
location- The location- Returns:
- The JSONObject which represent the
Location
-
-