STWGeolocation Manager
STWGeolocationManager
Public Class that manages all operations concerning geolocation tracking.
The main function of this class is to detect and stream location data to send it to the server or
to update a map to smoothly watch location updates as they change in the real world
This class offers several possible operations defined in the following list:
- Start or stop tracking the user' location
- Start or stop tracking other users' locations
- Send a request to change the geolocation tracking rules
- get the current active tracking rule
- get all available tracking rules
- Search for places by keyword
- Find address from specific position
- Get detailed address from specific position : address, zipCode, city, country, state
- Get updates about geolocation changes by registering to STWGeolocationFeaturesListener
- Get the geolocation tracking status of the subscriber which can be OFF, on REQUEST or on TRACKING
For starting the location service
STWGeolocationManager.getInstance().startTrackingDeviceLocation(context,
new TrackingDeviceLocationCallback() {
public void onSuccess() {
//Code...
}
public void onError(GeolocationError error) {
//Code...
}
});
Content copied to clipboard
To start tracking other users' locations
STWGeolocationManager.getInstance().startTrackingParticipantsLocations(users, refreshTime, new StartTrackingParticipantsCallback() {
public void onStartTracking() {
// code
}
public void onError(GeolocationError error) {
// code
}
});
Content copied to clipboard
Change the geolocation tracking rule
A tracking rule is a configurable condition that can be added from the administration platform to
determine a time interval for the tracking.
STWGeolocationManager.getInstance().changeGeolocationTrackingRuleRequest(context, ruleUUID,
new ChangeTrackingRuleCallback() {
public void success() {
//Code...
}
public void onError(GeolocationError error) {
//Code...
}
});
Content copied to clipboard
Search for places by keyword
STWGeolocationManager.getInstance().searchForPlaces(this, query, new STWSearchPlaceListener() {
public void onComplete(ArrayList<LocationAttachment> locations) {
//Code...
}
public void onError(GeolocationError error) {
//Code...
}
});
Content copied to clipboard
Find address from specific position
STWGeolocationManager.getInstance().getAddressFromPosition(location.getLatitude(),
location.getLongitude(), new STWRequestAddressListener() {
public void onComplete(String address) {
//Code...
}
public void onError(GeolocationError error) {
//Code...
}
});
Content copied to clipboard
Functions
Link copied to clipboard
Gets whether the user is able to deactivate the geolocation feature or not
Link copied to clipboard
open fun changeGeolocationTrackingRuleRequest( @NonNull context: Context, @NonNull ruleUUID: String, @Nullable listener: ChangeTrackingRuleCallback)
Content copied to clipboard
The ability to change the tracking rule may apply to users for whom the tracking option is enabled.
Link copied to clipboard
open fun enableGeolocationBatteryOptimization(@NonNull context: Context, enabled: Boolean)
Content copied to clipboard
By ignoring the geolocation battery optimization option, listening of motion sensor will be removed to keep listening for location services periodically.
Link copied to clipboard
open fun enableGeolocationWakeUp(@NonNull context: Context, enabled: Boolean)
Content copied to clipboard
Enable or not the geolocation wakeup feature locally
Link copied to clipboard
open fun enableRealtimeGeolocationMode(@NonNull context: Context, enabled: Boolean): Boolean
Content copied to clipboard
Enable/Disable the realtime geolocation mode
Link copied to clipboard
open fun getActiveGeolocationTrackingRule(@NonNull context: Context): GeolocTrackingRulesItem
Content copied to clipboard
Get the current active geolocation tracking rules
Link copied to clipboard
open fun getAddressFromPosition( latitude: Double, longitude: Double, @Nullable listener: STWRequestAddressListener)
Content copied to clipboard
Call this method to get the address information from a position
Link copied to clipboard
open fun getAllTrackingRules(@NonNull context: Context): List<GeolocTrackingRulesItem>
Content copied to clipboard
Call this method to get all tracking rules added from the backend
Link copied to clipboard
Get ArcGis Max Zoom Level
Link copied to clipboard
open fun getConfiguredMinDistanceForFastTracking(@NonNull context: Context): Double
Content copied to clipboard
Call this method to get the minimum distance configured for fast tracking only if the distance based location feature is enabled
Link copied to clipboard
open fun getCountryCodeFromPosition( latitude: Double, longitude: Double, @Nullable listener: STWRequestCountryCodeListener)
Content copied to clipboard
Call this method to get country code from the given position
Link copied to clipboard
open fun getCountryCodeFromUserPosition(@NonNull context: Context, @Nullable listener: STWRequestCountryCodeListener)
Content copied to clipboard
Call this method to get the country code from user position
Link copied to clipboard
open fun getDetailedAddressFromPosition( latitude: Double, longitude: Double, @Nullable listener: STWRequestDetailedAddressListener)
Content copied to clipboard
Call this method to get detailed address information from a position
Link copied to clipboard
Gets The subscriber geolocation status:
Link copied to clipboard
Link copied to clipboard
Get or create the single instance of STWGeolocationManager.
Link copied to clipboard
Call this method to get the time of the location, in elapsed real-time since system boot.
Link copied to clipboard
Gets the location icon corresponding to the given iconName.
Link copied to clipboard
Link copied to clipboard
Accessor.
Link copied to clipboard
Gets the current map provider value
Link copied to clipboard
Retrieve the OSM base URL used to download tiles.
Link copied to clipboard
Link copied to clipboard
The location tracking interval is configured from the backend.
Link copied to clipboard
Call this method to get all tracking rules count added from the backend
Link copied to clipboard
Retrieve the WMTS base URL used to download tiles.
Link copied to clipboard
Get Zoom Level
Link copied to clipboard
check if location could be sent : if is true launch geolocation in case of subscriberStatus is onTracking, else stop geolocation
Link copied to clipboard
Initialize the configuration related to the Map provider
Link copied to clipboard
open fun isChangingDistanceBasedLocationAllowed(@NonNull context: Context): Boolean
Content copied to clipboard
Allow the subscriber to activate or deactivate the distance based location feature.
Link copied to clipboard
open fun isChangingTrackingRulesEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Allow or not the subscriber to change geolocation tracking rules
Link copied to clipboard
Call this method to check whether user is dispatcher manager ot not
Link copied to clipboard
open fun isGeolocationBatteryOptimizationEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Check if Geolocation battery optimization is enabled
Link copied to clipboard
If the subscriber allow the geolocation
Link copied to clipboard
open fun isGeolocationTrackingRulesEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Check if the subscriber is allowed to change the geolocation tracking rule
Link copied to clipboard
Check if Geolocation Wakeup Device Feature is allowed from the backend
Link copied to clipboard
Check if Geolocation Wakeup Device feature is allowed locally by the user
Link copied to clipboard
open fun isLocationAcceptable(@NonNull newLocation: Location, @Nullable oldLocation: Location): Boolean
Content copied to clipboard
Determines whether one Location is better than the given location For Android 12 determining if the new location is acceptable compared to the old one is unuseful when the permission is accepted only for approximation and the return will be true.
Link copied to clipboard
open fun isRealtimeGeolocationEnabled(@NonNull context: Context): Boolean
Content copied to clipboard
Check if the realtime geolocation mode is enabled or not
Link copied to clipboard
open fun registerBeaconServiceListener(@NonNull listener: STWServiceListener)
Content copied to clipboard
Register the listener to handle Beacon service events.
Link copied to clipboard
open fun registerDispatcherStatusListener(@NonNull listener: STWDispatcherStatusListener)
Content copied to clipboard
Register to dispatcher status listener
Link copied to clipboard
open fun registerGeolocationChangesListener(@NonNull listener: STWGeolocationFeaturesListener)
Content copied to clipboard
register for geolocation changes listener
Link copied to clipboard
open fun registerGeolocationServiceListener(@NonNull listener: STWServiceListener)
Content copied to clipboard
Register the listener to handle geolocation service events.
Link copied to clipboard
open fun registerTrackingLocationListener(@NonNull listener: STWTrackingDeviceLocationListener)
Content copied to clipboard
Register the listener that will be notified by the user' location tracking events.
Link copied to clipboard
open fun registerTrackingParticipantsService(@NonNull listener: STWTrackingParticipantsListener)
Content copied to clipboard
Register the listener to handle tracking participants service events.
Link copied to clipboard
open fun searchForPlaces( @NonNull context: Context, @NonNull searchKey: String, @Nullable listener: STWSearchPlaceListener)
Content copied to clipboard
Call this method to handel search for places based on a keyword
Link copied to clipboard
open fun startTrackingDeviceLocation(@NonNull context: Context, @Nullable listener: TrackingDeviceLocationCallback)
Content copied to clipboard
Call this method to start the location tracking
Link copied to clipboard
open fun startTrackingParticipantsLocations( @NonNull users: Array<String>, refreshInterval: Int, @Nullable callback: StartTrackingParticipantsCallback)
Content copied to clipboard
Start tracking other users' locations
Link copied to clipboard
open fun stopTrackingDeviceLocation(@NonNull context: Context, @Nullable listener: TrackingDeviceLocationCallback)
Content copied to clipboard
Call this method to stop the location tracking
Link copied to clipboard
Stop tracking other users's locations
Link copied to clipboard
open fun unregisterBeaconServiceListener(@NonNull listener: STWServiceListener)
Content copied to clipboard
Unregister the Beacon service event listener
Link copied to clipboard
open fun unregisterDispatcherStatusListener(@NonNull listener: STWDispatcherStatusListener)
Content copied to clipboard
Unregister for dispatcher status listener
Link copied to clipboard
open fun unregisterGeolocationChangesListener(@NonNull listener: STWGeolocationFeaturesListener)
Content copied to clipboard
Unregister for geolocation changes listener
Link copied to clipboard
open fun unregisterGeolocationServiceListener(@NonNull listener: STWServiceListener)
Content copied to clipboard
Unregister the service event listener
Link copied to clipboard
open fun unregisterTrackingLocationListener(@NonNull listener: STWTrackingDeviceLocationListener)
Content copied to clipboard
Unregister the listener to not be notified by the location tracking events
Link copied to clipboard
open fun unregisterTrackingParticipantsService(@NonNull listener: STWTrackingParticipantsListener)
Content copied to clipboard
Unregister the tracking participant service