Locator
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);
Content copied to clipboard
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);
Content copied to clipboard
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);
Content copied to clipboard
See also
Parameters
<T>
Any class inherits the BaseLocatorConfig
<U>
Any callback implements the ILocationScan