STWAccountManager

open class STWAccountManager
STWAccountManager

This class represent the API for all actions/event related to the user account

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

  • Login
  • Logout
  • Manage all account settings
  • Listen to all changes of account settings

 

Login

  • 
    STWAccountManager.getInstance().login(BaseLoginActivity.this, number, companyId, new STWAccountManager.CompletionCallback() {
    
         public void onSecondStepStarted(int loginStatus) {
               //Code...
         }
    
         public void onCompletion(int loginType, Bundle data) {
               //Code...
         }
    
         public void onError(int loginFailReason, Bundle data) {
               //Code...
         }
         });
    
  • 
    STWAccountManager.getInstance().confirmLogin(context, activationCode, new STWAccountManager.CompletionCallback() {
    
         public void onSecondStepStarted(int loginStatus) {
                //Your code here
         }
    
         public void onCompletion(int loginType, Bundle data) {
                //Your code here
         }
    
         public void onError(int loginFailReason, Bundle data) {
                //Your code here
         }
    });
    

 

Logout


STWAccountManager.getInstance().launchLogoutProcess(context,true, new LogoutCallBack() {

     public void onStart() {
            //Code ...
     }

     public void onFinish() {
            //Code ...
     }

     public void onError() {
            //Code ...
     }
});

Manage all account settings


//Delete user picture
 STWAccountManager.getInstance().deleteUserPicture(new STWSettingRequestCallback() {

     public void onSuccess(){
           //Code ...
     }

     public void onFail() {
           //Code ...
     }

     public void onError(){
          //Code ...
     }
});

Get company id


         String companyId = STWAccountManager.getInstance().getCompanyId(context);
     

Listen to all changes of account settings


STWAccountManager.getInstance().registerAccountSettingsListener(new STWAccountSettingsListener() {

     public void onAccountSettingsUpdated(){
           //Code..
     }
});

Functions

Link copied to clipboard
open fun acceptNewDevice(@NonNull context: Context)
This method is useful when the current account is used by another device and want to use the current device
Link copied to clipboard
open fun <R : RegistrationCallback?> checkConfService(    @NonNull context: Context,     @NonNull phoneNumber: String,     @NonNull companyId: String,     @Nullable callback: R)
To check the configuration service
Link copied to clipboard
open fun checkScreenCaptureEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether the screen capture is enable or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun clearCompanyId(@NonNull context: Context)
Call this method to clear saved companyId
Link copied to clipboard
open fun <R : RegistrationCallback?> confirmLogin(@NonNull context: Context, @Nullable registrationCallback: R)
To be called after receiving a BAD_DEVICE_ID error.
Link copied to clipboard
open fun connect(    @NonNull context: Context,     @NonNull code: String,     @Nullable completionCallback: CompletionCallback)
A deprecated mode to connect a user, by providing the password
Link copied to clipboard
open fun defaultColorSkin(@NonNull context: Context, @Nullable defaultColor: String): String
Call this method to get the default color skin based on the configured parameter in the BE admin interface or the defaultColor if not configured.
Link copied to clipboard
open fun defaultResources(@NonNull resourcesType: String): Uri
Call this method to get the default android icons Uri based on the configured parameter in the BE admin interface or null if not configured.
Link copied to clipboard
open fun getAccountConnectionState(): String
Gets the current connection state with the backend.
Link copied to clipboard
open fun getAccountPhoneNumber(@NonNull context: Context): String
Retrieve the current saved account phone number
Link copied to clipboard
open fun getApplicationName(@NonNull context: Context, @Nullable defaultName: String): String
Call this method to get the [application name] either configured in the BE admin interface or default if not configured
Link copied to clipboard
open fun getAppRevision(@NonNull context: Context): String
Returns the latest application revision published
Link copied to clipboard
open fun getAppVersion(@NonNull context: Context): String
Returns the latest application version published
Link copied to clipboard
open fun getCompanyName(@NonNull context: Context, @Nullable defaultName: String): String
Call this method to get the [company name] either configured in the BE admin interface or default if not configured
Link copied to clipboard
open fun getCopyright(@NonNull context: Context, @Nullable defaultCopyright: String): String
Call this method to get the [copyright] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getCountryIsoCode(@NonNull context: Context): String
Returns the region where the current account phone number is from
Link copied to clipboard
open fun getEmbedlyApiKey(@NonNull context: Context, @Nullable defaultValue: String): String
The Embedly API key (empty if no key is configured)
Link copied to clipboard
open fun getGoogleStaticMapsApiKey(@NonNull context: Context, @Nullable defaultValue: String): String
The Google Static Maps API key (empty if no key is configured)
Link copied to clipboard
open fun getHelpLink(@NonNull context: Context): String
Returns the url address for on-line help
Link copied to clipboard
open fun getHttpPorts(@NonNull context: Context): String
Call this method to get the [HTTP ports] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getHttpPortsAsArray(@NonNull context: Context): Array<String>
Call this method to get the [HTTP ports] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getInstance(): STWAccountManager
Gets instance.
Link copied to clipboard
open fun getLoginType(): Int
retrieve the current login type
Link copied to clipboard
open fun getLogLevel(@NonNull context: Context, @Nullable defaultLogLevel: String): LogLevel
Call this method to get the [LogLevel] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getOauthTokenForExternalApi(@NonNull context: Context, @Nullable callback: STWOauthTokenCallback<OauthTokenError>)
Gets an oauth token useful to connect to an external API
Link copied to clipboard
open fun getOnlineHelpUri(@NonNull context: Context, defaultStatus: Boolean): Uri
Call this method to get the online help URI based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun getPrivacyPolicyUri(    @NonNull context: Context,     defaultStatus: Boolean,     @Nullable defaultUri: Uri): Uri
Call this method to get the privacy policy URI based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun getRestrictedNetworkCapability(@NonNull context: Context): Int
Call this method to get the network capability either configured in the BE admin interface or default if not configured.
open fun getRestrictedNetworkCapability(@NonNull context: Context, defaultNetwork: Int): Int
Please use getRestrictedNetworkCapability Call this method to get the network capability either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getSipPorts(@NonNull context: Context): String
Call this method to get the [SIP/VoIP ports] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getSipPortsAsArray(@NonNull context: Context): Array<String>
Call this method to get the [SIP/VoIP ports] either configured in the BE admin interface or default if not configured.
Link copied to clipboard
open fun getSupportMail(@NonNull context: Context): String
Returns the e-mail address for support
Link copied to clipboard
open fun getTermOfUseUri(    @NonNull context: Context,     defaultStatus: Boolean,     @Nullable defaultUri: Uri): Uri
Call this method to get the term of use URI based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isAppAlwaysConnectedModeEnabled(@NonNull context: Context): Boolean
Check if the app is in the always connected mode or not.
Link copied to clipboard
open fun isDebugActionModeEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether all debug actions (copy db file, activate logs, send logs,...) activated or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isDedicatedNetFallbackEnabled(@NonNull context: Context): Boolean
Call this method to check whether the app must allow fallback if restricted network is not available or not.
open fun isDedicatedNetFallbackEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Please use isDedicatedNetFallbackEnabled Call this method to check whether the app must allow fallback if restricted network is not available or not.
Link copied to clipboard
open fun isExternalUserInvitationAllowed(@NonNull context: Context): Boolean
Method to check if the virality - External user invitation feature is allowed ot not
Link copied to clipboard
open fun isFallbackPortsEnabled(@NonNull context: Context): Boolean
Call this method to check whether the fallback ports for HTTP and/or Sip is enabled or not based on the configuration of the http/sip ports in the BE admin interface or default if not configured.
Link copied to clipboard
open fun isGuest(@NonNull context: Context): Boolean
Method to check if the subscriber is a guest or not
Link copied to clipboard
open fun isInstallationDoneWithoutSIM(@NonNull context: Context): Boolean
Call this method to check if the login has been done with SIM card or not
Link copied to clipboard
open fun isInvitationByEmailEnabled(@NonNull context: Context): Boolean
Method to check if the invitation by Email is active or not
Link copied to clipboard
open fun isInvitationBySMSEnabled(@NonNull context: Context): Boolean
Method to check if the invitation by SMS is active or not
Link copied to clipboard
open fun isLoginFromNfc(@NonNull context: Context): Boolean
Returns whether the app is logged using the NFC tag or not
Link copied to clipboard
open fun isLogoutEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check if the [logout] feature is enabled or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isNewAppVersionNotificationEnabled(@NonNull context: Context): Boolean
Check if the new application version notification is allowed to be shown from administrator or not.
Link copied to clipboard
open fun isOnlineHelpEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether the online help is activated or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isPrivacyPolicyEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether the privacy policy is activated or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isSecureStorageCheckerEnabled(@NonNull context: Context): Boolean
Call this method to check whether the security disc encryption feature is enabled or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isTermOfUseEnabled(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether the term of use is activated or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isTLSEnabledForArcGIS(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether ArcGIS &Addok requests use TLS with https or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isTLSEnabledForOSM(@NonNull context: Context, defaultStatus: Boolean): Boolean
Call this method to check whether OSM requests use TLS with https or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun isUserAuthenticated(@NonNull context: Context): Boolean
Call this method to check if the current user is authenticated or not.
Link copied to clipboard
open fun isUserAuthenticatedAndAccountSynced(@NonNull context: Context): Boolean
Call this method to check if the application can be opened or not
Link copied to clipboard
open fun isVulnerabilityCheckerEnabled(@NonNull context: Context): Boolean
Call this method to check whether the check for rooted/vulnerable devices is enabled or not based on the configured parameter in the BE admin interface or the defaultStatus if not configured.
Link copied to clipboard
open fun localDisconnect(@NonNull context: Context, @Nullable callBack: STWDisconnectCallBack)
Call this method to do a local disconnect (simulate the system FORCE-STOP application) It is required, before invoke this method, to : - close ALL activities - cancel ALL notifications - stop services (or foreground services) - unregister from any broadcast receiver An event STWAutomaticDisconnectListener will be delegated when the disconnection process started or finished.
Link copied to clipboard
open fun login(    @NonNull context: Context,     loginType: Int,     @NonNull linkOrActivationCode: String,     @Nullable completionCallback: CompletionCallback)
open fun login(    @NonNull context: Context,     loginType: Int,     @NonNull linkOrActivationCode: String,     isFromNFC: Boolean,     @Nullable completionCallback: CompletionCallback)
Link copied to clipboard
open fun loginWithMDM(    @NonNull context: Context,     @NonNull activateCode: String,     @NonNull phoneNumber: String,     @NonNull companyId: String,     @NonNull fqdn: String,     @Nullable completionCallback: CompletionCallback)
Call this method to authenticate using an MDM system:
Link copied to clipboard
open fun logout(    @NonNull context: Context,     informAdmin: Boolean,     @Nullable callBack: LogoutCallBack)
This method is used to logout the current account.
Link copied to clipboard
open fun needUpdateApp(@NonNull context: Context): Boolean
Whether the client application must be updated or not
Link copied to clipboard
open fun register(    @NonNull context: Context,     @NonNull companyId: String,     @Nullable registrationCallback: RegisterOrganisationCallback)
Call this method to start registration with only companyId .
open fun <R : RegistrationCallback?> register(    @NonNull context: Context,     @NonNull userIdentifier: String,     @NonNull companyId: String,     @Nullable registrationCallback: R)
Call this method to start registration.The method should be called at the first beginning.
Link copied to clipboard
open fun registerForAutomaticDisconnectListener(@NonNull automaticDisconnectListener: STWAutomaticDisconnectListener)
Call this method to register for events related to automatic disconnect feature
Link copied to clipboard
open fun registerToAccountSessionState(@NonNull callback: STWAccountSessionCallback)
Register to the service connection states and errors
Link copied to clipboard
open fun registerToAppVersionChanges(@NonNull listener: STWAppVersionListener)
Register listener to handle events related to App version updates.
Link copied to clipboard
open fun registerToExternalUserEvents(@Nullable externalUserCallback: STWExternalUserListener)
Listen to the virality-External user invitation events.
Link copied to clipboard
open fun registerToIncorporateGuestListener(@Nullable incorporateGuestListener: STWIncorporateGuestListener)
Listen to the to the event related to the incorporate of guest in the organisation.
Link copied to clipboard
open fun resetApplicationData(@Nullable callback: ResetAppDataCallBack)
Call this method reset all application data including local preferences &database...
Link copied to clipboard
open fun synchronizedWithOtherDevices(@NonNull context: Context): Boolean
Whether the current subscriber uses other device(s) (i.
Link copied to clipboard
open fun unregisterForAutomaticDisconnectListener(@NonNull automaticDisconnectListener: STWAutomaticDisconnectListener)
Call this method to unregister from events related to automatic disconnect feature
open fun unregisterForDisconnectedUserFeatureChanged(@NonNull disconnectedUserFeatureChangedListener: STWDisconnectedUserFeatureChangedListener)
Call this method to unregister from events related to connected user feature
Link copied to clipboard
open fun unregisterFromAccountSessionState(@NonNull callback: STWAccountSessionCallback)
Unregister from the service connection states and errors
Link copied to clipboard
open fun unregisterFromExternalUserEvents(@Nullable externalUserCallback: STWExternalUserListener)
Stop listening to the virality-External user invitation events.
Link copied to clipboard
open fun unregisterFromIncorporateGuestListener(@Nullable incorporateGuestListener: STWIncorporateGuestListener)
Stop listening to the to the event related to the incorporate of guest in the organisation.
Link copied to clipboard
open fun unregisterToAppVersionChanges(@NonNull listener: STWAppVersionListener)
unregister listener to not handle anymore the events related to App version updates.
Link copied to clipboard
open fun usePhoneNumbers(@NonNull context: Context): Boolean
Call this method to check whether the SmartMS &Mobile uses phone numbers or not.