Locator

open class Locator<T : BaseLocatorConfig?, U : ILocationScan?>

This class gives the possibility to configure and customize the location retrieval process using some parameters.

This builder should be used in conjunction with the ILocationScan class

The following examples gives an idea how to create a custom locator configuration :

Example 1 :

Locator.Builder<BaseLocatorConfig, ILocationScan> defaultLocator =
    new Locator
        .Builder<>()
        .setData("<some data>")
        .setLocationListener(new ILocationScan() {

            public void requestLocationPermission(String[] permissions, int requestCode) {

            }

            public void onLocationChanged(Location location, String address, String data) {

            }

            public void onLocationNotFound(String data, boolean isPermissionDenied) {

            }
         })
        .setLocatorConfig(new DefaultLocatorConfig())
        .setLocationUpdatesDelay(3000L)
        .setMaxAttemptsLocation(7)
        .setUseAdditionalAttempts(true);
Example 2 :

Locator.Builder<BaseLocatorConfig, ILocationScan> defaultLocator =
    new Locator
        .Builder<>()
        .setData("<some data>")
        .setLocationListener(new ILocationScan() {

            public void requestLocationPermission(String[] permissions, int requestCode) {

            }

            public void onLocationChanged(Location location, String address, String data) {

            }

            public void onLocationNotFound(String data, boolean isPermissionDenied) {

            }
        })
        .setLocatorConfig(new EmergencyLocatorConfig())
        .setLocationUpdatesDelay(7000L)
        .setMaxAttemptsLocation(7)
        .setUseAdditionalAttempts(false);
Example 3 :

class CustomLocatorConfig extends BaseLocatorConfig {

    public boolean startLocationUpdates(IInternalLocatorCallback internalLocatorCallback) {
        return false;
    }

    public void stopLocationUpdates() {

    }
}

Locator.Builder<BaseLocatorConfig, ILocationScan> defaultLocator =
    new Locator
        .Builder<>()
        .setData("<some data>")
        .setLocationListener(new ILocationScan() {

            public void requestLocationPermission(String[] permissions, int requestCode) {

            }

            public void onLocationChanged(Location location, String address, String data) {

            }

            public void onLocationNotFound(String data, boolean isPermissionDenied) {

            }
        })
        .setLocatorConfig(new CustomLocatorConfig())
        .setLocationUpdatesDelay(3000L)
        .setMaxAttemptsLocation(3)
        .setUseAdditionalAttempts(false);

See also

Parameters

<T>

Any class inherits the BaseLocatorConfig

<U>

Any callback implements the ILocationScan

Types

Link copied to clipboard
open class Builder<T : BaseLocatorConfig?, U : ILocationScan?>

Properties

Link copied to clipboard
@get:NonNull
private open val data: String
Link copied to clipboard
private open val locationListener: U
Link copied to clipboard
private open val locationUpdatesDelay: Long
Link copied to clipboard
private open val locatorConfig: T
Link copied to clipboard
private open val maxAttemptsLocation: Int

Functions

Link copied to clipboard
open fun isUseAdditionalAttempts(): Boolean