STWLoneWorkerManager

open class STWLoneWorkerManager
STWLoneWorkerManager

Class responsible to manage all lone worker services ( Man down, Positive security)

 

This class offers several possible operations defined in the following list:

  • Start lone worker service
  • Stop lone worker service
  • Schedule lone worker service
  • reCalibration
  • Stop man down alert
  • Acknowledge an man down alert
  • Check services states

 

Start and check lone worker services

 


.......
STWLoneWorkerManager.getInstance().startLoneWorker(context, needToRestartService, loneWorkerStartCallback);
........

Stop lone worker service


......
STWLoneWorkerManager.getInstance().stopLoneWorker(context);
......

Schedule lone worker service


......
STWLoneWorkerManager.getInstance().scheduleLoneWorker(context, loneWorkerDelay, informServer);
......

reCalibration


......
STWLoneWorkerManager.getInstance().recalibrate(context, loneWorkerStartCallback);
......

Stop man down alert


.....
STWLoneWorkerManager.getInstance().stopManDownAlert(context);
........
or

.....
STWLoneWorkerManager.getInstance().stopManDownAlert(Context context , String threadId);
........

Acknowledge an man down alert


.....
STWLoneWorkerManager.getInstance().setManDownAlertAcknowledged(this, messageId);
........

Types

Link copied to clipboard
interface LoneWorkerCallback
Link copied to clipboard
interface ManDownCallback
Link copied to clipboard
interface PositiveSecurityCallback
Link copied to clipboard
interface SnoozeCallback

Functions

Link copied to clipboard
open fun cancelManDownAlert(@NonNull context: Context, angle: Int)
Use this method to cancel the current man down alert operation
Link copied to clipboard
open fun getCurrentManDownState(): String
Use this method to retrieve the current ManDown state
Link copied to clipboard
open fun getInstance(): STWLoneWorkerManager
Link copied to clipboard
open fun getLastConnectionLostTime(): Date
Use this method to retrieve the positive security connection lost time
Link copied to clipboard
open fun getLastManDownThreadId(): String
Use this method retrieve the last threadID for the emergency man down alert
Link copied to clipboard
open fun getPreAlarmProgressState(): Pair<Long, Long>
Use this method to retrieve the current preAlarm progress value and the preAlarm configured delay
Link copied to clipboard
open fun initLoneWorkerUserSettings(@NonNull loneWorkerUserSettingsConfig: LoneWorkerUserSettingsConfig)
Use this method to initialise the LoneWorker settings config
Link copied to clipboard
open fun isConnectionLostDetected(): Boolean
Use this method to check if the connection lost is detected or not
Link copied to clipboard
open fun isConversationForManDown(@NonNull context: Context, @NonNull threadId: String): Boolean
Check if the conversation is for Man Down
Link copied to clipboard
open fun isDeviceCalibrated(): Boolean
If the caliration is already Done
Link copied to clipboard
open fun isLoneWorkerAllowed(): Boolean
If the subscriber is allowed to use lone worker feature
Link copied to clipboard
open fun isManDown(): Boolean
Link copied to clipboard
open fun isManDownCall(@NonNull callerPhoneItem: PhoneItem): Boolean
Use this method to check if the caller phone is in the man down recipient call or not
Link copied to clipboard
open fun isManDownDetectionAllowed(): Boolean
If the subscriber is allowed to use man down feature
Link copied to clipboard
open fun isManDownEnabled(@NonNull context: Context): Boolean
If the subscriber is allowed to use man down feature and ManDown detection recipient is not empty
Link copied to clipboard
open fun isPositiveSecurityAllowed(): Boolean
If the subscriber is allowed to use positive security feature
Link copied to clipboard
open fun positiveSecurityAcknowledged()
Use this method when positive security alarm is acknowledged
Link copied to clipboard
open fun recalibrate(@NonNull context: Context, @Nullable callback: LoneWorkerStartCallback)
Use this method to restart the calibration phase again
Link copied to clipboard
open fun registerPreAlarmTimerObserver(@NonNull smartMSTimerObserver: SmartMSTimerObserver)
Use this method to listen for the ManDown PreAlarm timer
Link copied to clipboard
open fun registerToLoneWorkerEvent(@NonNull loneWorkerCallback: STWLoneWorkerManager.LoneWorkerCallback)
Register the specified listener to be notified by any Lone worker changes
Link copied to clipboard
open fun registerToManDownEvent(@NonNull manDownCallback: STWLoneWorkerManager.ManDownCallback)
Register the specified listener to be notified by any Man down changes
Link copied to clipboard
open fun registerToPositiveSecurityEvent(@NonNull positiveSecurityCallback: STWLoneWorkerManager.PositiveSecurityCallback)
Register the specified listener to be notified by any Positive security changes
Link copied to clipboard
open fun scheduleLoneWorker(@NonNull context: Context, loneWorkerDelay: Int)
open fun scheduleLoneWorker(    @NonNull context: Context,     loneWorkerDelay: Int,     informServer: Boolean)
Use this method to schedule the start of the lone worker manager
Link copied to clipboard
open fun setManDownAlertAcknowledged(@NonNull context: Context, @NonNull message: BaseMessage)
Link copied to clipboard
open fun startLoneWorker(    @NonNull context: Context,     needToRestartService: Boolean,     @Nullable callback: LoneWorkerStartCallback)
Use this method to start the lone worker service
open fun startLoneWorker(    @NonNull context: Context,     needToRestartService: Boolean,     startCalibration: Boolean,     phoneIsLocked: Boolean,     @Nullable callback: LoneWorkerStartCallback)
Use this method to start the lone worker manager
Link copied to clipboard
open fun stopLoneWorker(@NonNull context: Context)
Use this method to stop the lone worker manager
Link copied to clipboard
open fun stopManDownAlert(@NonNull context: Context)
Use this method to stop the man down alert
open fun stopManDownAlert(@NonNull context: Context, @NonNull threadId: String)
Stop the man down alert corresponding the the specified thread
Link copied to clipboard
open fun unregisterLoneWorkerEvent(@NonNull loneWorkerCallback: STWLoneWorkerManager.LoneWorkerCallback)
Unregister the specified listener to not receive any more the Lone worker changes
Link copied to clipboard
open fun unregisterManDownEvent(@NonNull manDownCallback: STWLoneWorkerManager.ManDownCallback)
Unregister the specified listener to not receive any more the Man down changes
Link copied to clipboard
open fun unregisterPositiveSecurityEvent(@NonNull positiveSecurityCallback: STWLoneWorkerManager.PositiveSecurityCallback)
Unregister the specified listener to not receive any more the Positive security changes
Link copied to clipboard
open fun unregisterPreAlarmTimerObserver(@NonNull smartMSTimerObserver: SmartMSTimerObserver)
Use this method to remove the previously listener instance callback