Webcom
A Webcom object is the entry point to the Webcom Datasync and Authentication services.
Important change over the legacy API: Initialization
Before you can instantiate a Webcom object, the SDK must have completed its initialization. To do so, you should register a Runnable to be called after the initialization is complete using the Webcom.onReady static method. Once any listener registered through this method has been called, all subsequent calls to the the are safe.
Examples
Java
Webcom.onReady(() -> {
Webcom ref = new Webcom("<your-app>");
(...)
});
Kotlin
Webcom.onReady {
val ref = Webcom("<your-app>")
(...)
}
Constructors
Creates a reference that represents the Webcom application.
Types
Functions
Adds a new account to the app referred to by this Webcom instance. See Webcom.addIdentity.
Adds a new account to the app referred to by this Webcom instance. The new account is associated to a new identity with the provider
authentication method, whose details (typically msisdn, email or password) are provided by the details
parameter. Currently, only 2 authentication methods are available to add an account: "password" (authentication with email and password) or "phone" (authentication with msisdn and one-time-password).
Authenticates a user using her/his phone number. This method requires sending beforehand a one-time-password (OTP) to the user using the Webcom.sendOtp method. This operation is performed asynchronously. Upon authentication completion or failure, the registered authentication callbacks are called (see Webcom.registerAuthCallback).
Retrieves the raw value of the current state of the Datasync service (low-level).
Removes the Webcom account of the currently authenticated user. Note that all identities attached to this account will also be deleted.
Removes the identity of the currently authenticated user from her/his Webcom account. This identity will then be no longer available for authenticating the user. All other identities attached to this account will remain and will still be available for authentication. However, note that if the removed identity is the last attached one to the user account, then the whole account is deleted (otherwise it would result in a "ghost" account with no means of authentication).
Sends a one time password to a user using the default "login"
message template.
Sends a one time password to a user. Such a temporary password may then be used to authenticate the user using the Webcom.authInternally method.
Returns the working status of the Datasync service associated with this instance wrt. to the network connection.
Subscribes to a given NotificationEvent on the current data node path, to be received through the HMS (Huawei Mobile Service) push mobile notifications sent to a given deviceId. This operation requires to be authenticated.
Subscribes to a given set of NotificationEvents on the current data node path, to be received through the HMS (Huawei Mobile Service) push mobile notifications sent to a given deviceId. This operation requires to be authenticated.
Subscribes to a given NotificationEvent on the current data node path, to be received through the FCM (Firebase Cloud Messaging) push mobile notifications sent to a given deviceId. This operation requires to be authenticated.
Subscribes to a given set of NotificationEvents on the current data node path, to be received through the FCM (Firebase Cloud Messaging) push mobile notifications sent to a given deviceId. This operation requires to be authenticated.
Unsubscribes from NotificationEvents on the current data node path, so that no longer HMS (Huawei Mobile Service) push mobile notifications are sent to the given deviceId. This operation requires to be authenticated.
Unsubscribes from NotificationEvents on the current data node path, so that no longer FCM (Firebase Cloud Messaging) push mobile notifications are sent to the given deviceId. This operation requires to be authenticated.
Verifies the authentication details (typically msisdn or email address) of a newly created identity using the Webcom.addIdentity method. If the verification is successful, then the user is automatically authenticated with the verified identity.