Class 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 use FusedLocationProviderClient to collect last location data, if FusedLocationProviderClient class 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.
    • Field Summary

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void collect​(android.content.Context context, FRListener<org.json.JSONObject> listener)
      Collect the device data.
      java.lang.String getName()
      Retrieve the name of the Collector
      protected org.json.JSONObject result​(android.location.Location location)
      Convert Location to JSONObject
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LocationCollector

        public LocationCollector()
    • Method Detail

      • getName

        public java.lang.String getName()
        Description copied from interface: DeviceCollector
        Retrieve the name of the Collector
        Specified by:
        getName in interface DeviceCollector
        Returns:
        The name of the Collector
      • collect

        public void collect​(android.content.Context context,
                            FRListener<org.json.JSONObject> listener)
        Description copied from interface: DeviceCollector
        Collect the device data.
        Specified by:
        collect in interface DeviceCollector
        Parameters:
        context - The Application Context
        listener - Listener to listen for collected data.
      • result

        protected org.json.JSONObject result​(android.location.Location location)
        Convert Location to JSONObject
        Parameters:
        location - The location
        Returns:
        The JSONObject which represent the Location