public class Webcom
extends Query
A Webcom object is the entry point to the Webcom Datasync and Authentication services.
Before you can instantiate a class 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.
Webcom.onReady(() -> {
Webcom ref = new Webcom("");
(...)
});
Webcom.onReady {
val ref = Webcom("")
(...)
}
class Webcom
,
Runnable,
Webcom.onReady
Modifier and Type | Class and Description |
---|---|
static class |
Webcom.Companion |
Modifier and Type | Field and Description |
---|---|
static Webcom.Companion |
Companion |
Constructor and Description |
---|
Webcom(java.net.URL url,
WebcomOptions options)
Deprecated.
|
Webcom(java.net.URL url)
Deprecated.
|
Webcom(java.lang.String url,
WebcomOptions options)
Deprecated.
|
Webcom(java.lang.String url)
Deprecated.
|
Webcom(WebcomApp application,
WebcomOptions options)
Creates a reference that represents the Webcom application.
|
Webcom(WebcomApp application)
Creates a reference that represents the Webcom application.
|
Modifier and Type | Method and Description |
---|---|
void |
addAccount(java.lang.String provider,
AuthDetails details,
MessageDetails messageDetails,
OnAuth callback)
Deprecated.
|
void |
addAccount(java.lang.String provider,
AuthDetails details,
OnAuth callback)
Deprecated.
|
void |
addIdentity(java.lang.String provider,
AuthDetails details,
MessageDetails messageDetails,
OnAuth callback)
Adds a new account to the app referred to by this
class 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). |
void |
addIdentity(java.lang.String provider,
AuthDetails details,
OnAuth callback)
Adds a new account to the app referred to by this
class Webcom instance.
See Webcom.addIdentity . |
void |
authAnonymously(OnAuth callback) |
void |
authAnonymously() |
void |
authInternally(java.lang.String provider,
com.orange.webcom.sdk.internal.Credentials credentials,
OnAuth callback) |
void |
authInternally(java.lang.String provider,
com.orange.webcom.sdk.internal.Credentials credentials) |
void |
authWithCustomProvider(java.lang.String provider,
java.lang.String token,
OnAuth callback) |
void |
authWithCustomProvider(java.lang.String provider,
java.lang.String token) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider,
AuthOptions options,
OnAuthWithOAuth listener,
boolean forcesWebView) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider,
AuthOptions options,
OnAuthWithOAuth listener) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider,
AuthOptions options) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider,
OnAuthWithOAuth listener,
AuthOptions options) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider,
OnAuthWithOAuth listener) |
void |
authWithOAuth(android.content.Context context,
java.lang.String provider) |
void |
authWithPassword(java.lang.String email,
java.lang.String password,
OnAuth callback)
Deprecated.
|
void |
authWithPassword(java.lang.String email,
java.lang.String password)
Deprecated.
|
void |
authWithPhone(java.lang.String id,
java.lang.String challenge,
java.lang.String password)
Deprecated.
|
void |
authWithPhone(java.lang.String id,
java.lang.String challenge,
java.lang.String password,
OnAuth callback)
Deprecated.
|
void |
authWithToken(java.lang.String token,
OnAuth callback) |
void |
authWithWassup(AuthOptions options,
OnAuth listener) |
void |
authWithWassup(AuthOptions options) |
void |
authWithWassup(OnAuth listener) |
void |
changePassword(java.lang.String email,
java.lang.String oldPassword,
java.lang.String newPassword,
OnComplete callback) |
Webcom |
child(java.lang.String relativePath)
Returns a reference on the data node specified by a path relatively to the data node referred to by this instance.
|
void |
createUser(java.lang.String email,
java.lang.String password,
OnAuth callback)
Deprecated.
|
java.lang.Object |
getDatasyncState()
Retrieves the raw value of the current state of the Datasync service (low-level).
|
java.lang.String |
getName() |
void |
goOffline()
Forces disconnection of the Datasync service associated with this instance from the Webcom back end.
|
void |
goOnline()
Forces reconnection of the Datasync service associated with this instance to the Webcom back end.
|
java.lang.Object |
internalRepresentation() |
void |
logout(OnComplete onComplete) |
void |
logout() |
java.lang.String |
name() |
OnDisconnect |
onDisconnect() |
static void |
onReady(java.lang.Runnable runnable)
Registers the
runnable callback to be called as soon as the Webcom SDK has completed its initialization. |
Webcom |
parent()
Returns a reference on the parent data node wrt. to the data node referred to by this instance.
|
void |
persist() |
Webcom |
push()
Returns a reference on a child data node with a unique key.
|
Webcom |
push(java.lang.Object data,
OnComplete onComplete)
Write some given
data under a new child data node with a unique key. |
Webcom |
push(java.lang.Object data)
Write some given
data under a new child data node with a unique key. |
void |
registerAuthCallback(OnAuth onAuth) |
void |
remove(OnComplete onComplete) |
void |
remove() |
void |
removeAccount(OnComplete callback)
Removes the Webcom account of the currently authenticated user. Note that all identities attached to this account
will also be deleted.
|
void |
removeAccount()
Removes the Webcom account of the currently authenticated user. Note that all identities attached to this account
will also be deleted.
|
void |
removeIdentity(OnComplete callback)
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).
|
void |
removeIdentity()
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).
|
void |
removeUser(java.lang.String email,
java.lang.String password,
OnAuth callback)
Deprecated.
|
void |
resume() |
Webcom |
root()
Returns a reference on the root data node of the Datasync service associated with this instance.
|
void |
sendConfirmationEmail(java.lang.String email,
OnComplete callback)
Deprecated.
|
void |
sendOtp(java.lang.String provider,
java.lang.String id,
MessageDetails messageDetails,
OnValue callback)
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. |
void |
sendOtp(java.lang.String provider,
java.lang.String id,
OnValue callback)
Sends a one time password to a user using the default
"login" message template. |
void |
sendPasswordResetCode(java.lang.String provider,
java.lang.String id,
MessageDetails messageDetails,
OnComplete callback) |
void |
sendPasswordResetCode(java.lang.String provider,
java.lang.String id,
MessageDetails messageDetails) |
void |
sendPasswordResetCode(java.lang.String provider,
java.lang.String id) |
void |
sendPasswordResetCode(java.lang.String provider,
java.lang.String id,
OnComplete callback) |
void |
sendPasswordResetEmail(java.lang.String email,
OnAuth callback)
Deprecated.
|
void |
sendVerificationCode(java.lang.String provider,
java.lang.String id,
MessageDetails messageDetails,
OnValue callback) |
void |
sendVerificationCode(java.lang.String provider,
java.lang.String id,
OnValue callback) |
java.lang.Object |
set(java.lang.Object data,
OnComplete onComplete) |
java.lang.Object |
set(java.lang.Object data) |
boolean |
shouldBeOnline()
Returns the working status of the Datasync service associated with this instance wrt. to the network connection.
|
void |
subscribe(java.lang.Object jsDescriptor,
java.lang.Object jsTarget,
OnValue callback) |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
NotificationEvent event,
boolean receiveRevocations,
java.util.Date expiration,
OnComplete callback)
Subscribes to a given
enum NotificationEvent on the current data node path, to be received through push mobile
notifications sent to a given deviceId . This operation requires to be authenticated. |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
NotificationEvent event,
boolean receiveRevocations,
OnComplete callback)
Subscribes to a given
enum NotificationEvent on the current data node path, to be received through push mobile
notifications sent to a given deviceId . This operation requires to be authenticated. |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
NotificationEvent event,
OnComplete callback)
Subscribes to a given
enum NotificationEvent on the current data node path, to be received through push mobile
notifications sent to a given deviceId . This operation requires to be authenticated. |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events,
boolean receiveRevocations,
java.util.Date expiration,
OnComplete callback)
Subscribes to a given set of
enum NotificationEvent s on the current data node path, to be received through push
mobile notifications sent to a given deviceId . This operation requires to be authenticated. |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events,
boolean receiveRevocations,
OnComplete callback)
Subscribes to a given set of
enum NotificationEvent s on the current data node path, to be received through push
mobile notifications sent to a given deviceId . This operation requires to be authenticated. |
void |
subscribeWithMobileNotifications(java.lang.String deviceId,
java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events,
OnComplete callback)
Subscribes to a given set of
enum NotificationEvent s on the current data node path, to be received through push
mobile notifications sent to a given deviceId . This operation requires to be authenticated. |
java.lang.String |
toString() |
void |
transaction(TransactionCallback callbacks,
boolean applyLocally) |
void |
transaction(TransactionCallback callbacks) |
void |
unregisterAuthCallback(OnAuth onAuth) |
void |
unsubscribe(java.lang.Object jsTarget,
OnValue callback) |
void |
unsubscribeWithMobileNotifications(java.lang.String deviceId,
OnComplete callback)
Unsubscribes from
enum NotificationEvent s on the current data node path, so that no longer push mobile notifications
are sent to the given deviceId . This operation requires to be authenticated. |
void |
unsubscribeWithMobileNotifications(java.lang.String deviceId)
Unsubscribes from
enum NotificationEvent s on the current data node path, so that no longer push mobile notifications
are sent to the given deviceId . This operation requires to be authenticated. |
void |
update(java.lang.Object data,
OnComplete onComplete) |
void |
update(java.lang.Object data) |
void |
updateEmailPasswordProfile(java.lang.String path,
java.lang.Object data,
OnComplete callback)
Deprecated.
|
void |
updateEmailPasswordProfile(java.lang.Object data,
OnComplete callback)
Deprecated.
|
void |
updateIdentityProfile(java.lang.String path,
java.lang.Object data,
OnComplete callback) |
void |
updateIdentityProfile(java.lang.Object data,
OnComplete callback) |
void |
useCurrentContextForNextAuthOperation() |
void |
useNewContextForNextAuthOperation() |
void |
verifyIdentity(java.lang.String provider,
java.lang.String id,
VerificationData data,
OnAuth callback)
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. |
static void |
waitForReady()
Blocks the calling thread until the Webcom SDK has completed its initialization.
|
void |
wakeupSubscribe(java.lang.String id,
java.lang.String mode,
OnComplete callback) |
void |
wakeupSubscribe(java.lang.String id,
OnComplete callback) |
void |
wakeupUnsubscribe(java.lang.String id,
OnComplete callback) |
cleanOfflineData, endAt, endAt, equalTo, finalize, getPath, getUid, limit, off, off, off, off, offPreservingOfflineData, offPreservingOfflineData, offPreservingOfflineData, offPreservingOfflineData, offlineData, on, on, once, path, queryIdentifier, queryObject, ref, startAt, startAt
public static Webcom.Companion Companion
@JvmOverloads @Deprecated public Webcom(@NotNull java.net.URL url, @Nullable WebcomOptions options)
@JvmOverloads @Deprecated public Webcom(@NotNull java.net.URL url)
@JvmOverloads @Deprecated public Webcom(@NotNull java.lang.String url, @Nullable WebcomOptions options)
@JvmOverloads @Deprecated public Webcom(@NotNull java.lang.String url)
@JvmOverloads public Webcom(@NotNull WebcomApp application, @Nullable WebcomOptions options)
Creates a reference that represents the Webcom application.
When specified, the options make it possible to customise some initialisation behaviors.
class WebcomOptions
@JvmOverloads public Webcom(@NotNull WebcomApp application)
Creates a reference that represents the Webcom application.
When specified, the options make it possible to customise some initialisation behaviors.
class WebcomOptions
@NotNull public java.lang.Object getDatasyncState()
Retrieves the raw value of the current state of the Datasync service (low-level).
public void goOnline()
Forces reconnection of the Datasync service associated with this instance to the Webcom back end.
It makes the shouldBeOnline
method return true
whatever the network state. If the network is unavailable,
then it will reconnect automatically as soon as the network becomes available with a back-off retry policy.
shouldBeOnline
,
goOffline
public void goOffline()
Forces disconnection of the Datasync service associated with this instance from the Webcom back end.
It makes the shouldBeOnline
method return false
whatever the network state and all datasync operations work
offline on the client. The reconnection to the back end must be forced by calling the goOnline
method.
shouldBeOnline
,
goOnline
@NotNull public Webcom root()
Returns a reference on the root data node of the Datasync service associated with this instance.
@NotNull public Webcom child(@NotNull java.lang.String relativePath)
Returns a reference on the data node specified by a path relatively to the data node referred to by this instance.
The path
specification accommodates the following rules:
It may include several path segments separated by slashes ("/"
),
It is always interpreted relatively to the current data node, even if it starts with a slash,
Special path segments "."
and ".."
are interpreted as "same node" and "parent node".
Warning: ".."
on the root data node returns itself (and not null
as the parent
method does),
Special path segments starting with "#"
or ".hash."
are expanded into 4 level paths that hash
the initial segment name, in order to handle very large lists (up to more than 10^15 elements,
see Browse data),
Special path segments starting with ".list."
give a hint to the Webcom back end that the corresponding nodes
are intended to have many children (as a list) so that it optimises the individual retrieval of their children,
preventing retrieving the nodes as a whole when the data of all their children become too big.
path
,
parent
,
Browse data@Nullable public Webcom parent()
Returns a reference on the parent data node wrt. to the data node referred to by this instance.
If this instance points to the root data node of the Datasync service associated with this instance, then this
method returns null
.
@NotNull public Webcom push()
Returns a reference on a child data node with a unique key.
The key (or name) of the child data node is guaranteed to be unique and lexicographically ordered after any
previously generated key by any of the push
methods. This method doesn't write anything in the Webcom database
and works synchronously.
push
@JvmOverloads @NotNull public Webcom push(@Nullable java.lang.Object data, @Nullable OnComplete onComplete)
Write some given data
under a new child data node with a unique key.
The key (or name) of the child data node where to write the data
is guaranteed to be unique and
lexicographically ordered after any previously generated key by any of the push
methods. The data
is written
asynchronously, the given onComplete
callback object will be called as soon as the write is acknowledged by
the back end. However, the method itself returns synchronously a class Webcom
reference on the child data node where
the write operation will take place.
data
is to be writtendata
,
data
,
push
,
data
,
onComplete
,
class Webcom
@JvmOverloads @NotNull public Webcom push(@Nullable java.lang.Object data)
Write some given data
under a new child data node with a unique key.
The key (or name) of the child data node where to write the data
is guaranteed to be unique and
lexicographically ordered after any previously generated key by any of the push
methods. The data
is written
asynchronously, the given onComplete
callback object will be called as soon as the write is acknowledged by
the back end. However, the method itself returns synchronously a class Webcom
reference on the child data node where
the write operation will take place.
data
is to be writtendata
,
data
,
push
,
data
,
onComplete
,
class Webcom
@JvmOverloads @NotNull public java.lang.Object set(@Nullable java.lang.Object data, @Nullable OnComplete onComplete)
@JvmOverloads @NotNull public java.lang.Object set(@Nullable java.lang.Object data)
@JvmOverloads public void remove(@Nullable OnComplete onComplete)
@JvmOverloads public void remove()
@JvmOverloads public void update(@Nullable java.lang.Object data, @Nullable OnComplete onComplete)
@JvmOverloads public void update(@Nullable java.lang.Object data)
public void resume()
@JvmOverloads public void logout(@Nullable OnComplete onComplete)
@JvmOverloads public void logout()
public void registerAuthCallback(@NotNull OnAuth onAuth)
public void unregisterAuthCallback(@NotNull OnAuth onAuth)
@Nullable public java.lang.String getName()
@Nullable public java.lang.String name()
public void persist()
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider, @NotNull AuthOptions options, @Nullable OnAuthWithOAuth listener, boolean forcesWebView)
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider, @NotNull AuthOptions options, @Nullable OnAuthWithOAuth listener)
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider, @NotNull AuthOptions options)
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider, @Nullable OnAuthWithOAuth listener, @NotNull AuthOptions options)
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider, @Nullable OnAuthWithOAuth listener)
@JvmOverloads public void authWithOAuth(@NotNull android.content.Context context, @NotNull java.lang.String provider)
@JvmOverloads public void authAnonymously(@Nullable OnAuth callback)
@JvmOverloads public void authAnonymously()
@JvmOverloads @Deprecated public void authWithPassword(@NotNull java.lang.String email, @NotNull java.lang.String password, @Nullable OnAuth callback)
@JvmOverloads @Deprecated public void authWithPassword(@NotNull java.lang.String email, @NotNull java.lang.String password)
@JvmOverloads public void authInternally(@NotNull java.lang.String provider, @NotNull com.orange.webcom.sdk.internal.Credentials credentials, @Nullable OnAuth callback)
@JvmOverloads public void authInternally(@NotNull java.lang.String provider, @NotNull com.orange.webcom.sdk.internal.Credentials credentials)
@JvmOverloads public void authWithCustomProvider(@NotNull java.lang.String provider, @NotNull java.lang.String token, @Nullable OnAuth callback)
@JvmOverloads public void authWithCustomProvider(@NotNull java.lang.String provider, @NotNull java.lang.String token)
public void authWithToken(@NotNull java.lang.String token, @Nullable OnAuth callback)
@JvmOverloads public void authWithWassup(@NotNull AuthOptions options, @Nullable OnAuth listener)
@JvmOverloads public void authWithWassup(@NotNull AuthOptions options)
public void authWithWassup(@Nullable OnAuth listener)
@Deprecated public void authWithPhone(@NotNull java.lang.String id, @NotNull java.lang.String challenge, @NotNull java.lang.String 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
).
id
- The MSISDN (without the "+" prefix) of the user to authenticatechallenge
- The identifier of the OTP previously sent to the userpassword
- The OTP received by the userWebcom.sendOtp
,
Webcom.registerAuthCallback
@Deprecated public void authWithPhone(@NotNull java.lang.String id, @NotNull java.lang.String challenge, @NotNull java.lang.String password, @Nullable OnAuth callback)
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
).
id
- The MSISDN (without the "+" prefix) of the user to authenticatechallenge
- The identifier of the OTP previously sent to the userpassword
- The OTP received by the usercallback
- The callback called when the authentication completes or fails. In case of success,OnAuth.onComplete
is called with an object representing theauthenticated userWebcom.sendOtp
,
Webcom.registerAuthCallback
public void sendOtp(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable MessageDetails messageDetails, @NotNull OnValue callback)
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.
provider
- The authentication method associated to the OTP to send. Possible values are "password"
or "phone"
id
- The identifier of the user whom to send the OTP to for the chosen provider
. For the"password"
provider, it is expected to be an email address, for the "phone"
provider, it is expected to be a msisdnmessageDetails
- Template of message used to send the OTP (among the messages defined on the Webcom developerconsole)callback
- The callback called when the sending is completed or fails. In case of success, theOnValue.onValue
method receives the identifier of the send OTP (orchallenge) as a interface JSONValue
. Typically, this challenge is required by theWebcom.authInternally
method.Webcom.authInternally
public void sendOtp(@NotNull java.lang.String provider, @NotNull java.lang.String id, @NotNull OnValue callback)
Sends a one time password to a user using the default "login"
message template.
provider
- The authentication method associated to the OTP to send. Possible values are "password"
or "phone"
id
- The identifier of the user whom to send the OTP to for the chosen provider
. For the"password"
provider, it is expected to be an email address, for the "phone"
provider, it is expected to be a msisdncallback
- The callback called when the sending is completed or fails. In case of success, theOnValue.onValue
method receives the identifier of the send OTP (orchallenge) as a interface JSONValue
. Typically, this challenge is required by theWebcom.authInternally
method.Webcom.sendOtp
public void changePassword(@NotNull java.lang.String email, @NotNull java.lang.String oldPassword, @NotNull java.lang.String newPassword, @Nullable OnComplete callback)
@Deprecated public void createUser(@NotNull java.lang.String email, @NotNull java.lang.String password, @Nullable OnAuth callback)
@Deprecated public void removeUser(@NotNull java.lang.String email, @NotNull java.lang.String password, @Nullable OnAuth callback)
@Deprecated public void sendConfirmationEmail(@NotNull java.lang.String email, @Nullable OnComplete callback)
public void sendVerificationCode(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable MessageDetails messageDetails, @Nullable OnValue callback)
public void sendVerificationCode(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable OnValue callback)
@Deprecated public void sendPasswordResetEmail(@NotNull java.lang.String email, @Nullable OnAuth callback)
@JvmOverloads public void sendPasswordResetCode(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable MessageDetails messageDetails, @Nullable OnComplete callback)
@JvmOverloads public void sendPasswordResetCode(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable MessageDetails messageDetails)
@JvmOverloads public void sendPasswordResetCode(@NotNull java.lang.String provider, @NotNull java.lang.String id)
public void sendPasswordResetCode(@NotNull java.lang.String provider, @NotNull java.lang.String id, @Nullable OnComplete callback)
@Deprecated public void updateEmailPasswordProfile(@Nullable java.lang.String path, @Nullable java.lang.Object data, @Nullable OnComplete callback)
@Deprecated public void updateEmailPasswordProfile(@Nullable java.lang.Object data, @Nullable OnComplete callback)
public void updateIdentityProfile(@Nullable java.lang.String path, @Nullable java.lang.Object data, @Nullable OnComplete callback)
public void updateIdentityProfile(@Nullable java.lang.Object data, @Nullable OnComplete callback)
@JvmOverloads public void removeAccount(@Nullable OnComplete callback)
Removes the Webcom account of the currently authenticated user. Note that all identities attached to this account will also be deleted.
If no user is currently authenticated, then this operation fails. In addition, as this operation is sensible, it also fails if the authentication token of the current user is too old. In this case, the application may ask the user to authenticate afresh.
callback
- The callback called when the removal operation completes or failsWebcom.removeIdentity
@JvmOverloads public void removeAccount()
Removes the Webcom account of the currently authenticated user. Note that all identities attached to this account will also be deleted.
If no user is currently authenticated, then this operation fails. In addition, as this operation is sensible, it also fails if the authentication token of the current user is too old. In this case, the application may ask the user to authenticate afresh.
Webcom.removeIdentity
@JvmOverloads public void removeIdentity(@Nullable OnComplete callback)
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).
If no user is currently authenticated, then this operation fails. In addition, as this operation is sensible, it also fails if the authentication token of the current user is too old. In this case, the application may ask the user to authenticate afresh.
callback
- The callback called when the removal operation completes or failsWebcom.removeAccount
@JvmOverloads public void removeIdentity()
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).
If no user is currently authenticated, then this operation fails. In addition, as this operation is sensible, it also fails if the authentication token of the current user is too old. In this case, the application may ask the user to authenticate afresh.
Webcom.removeAccount
public void addIdentity(@NotNull java.lang.String provider, @NotNull AuthDetails details, @Nullable MessageDetails messageDetails, @Nullable OnAuth callback)
Adds a new account to the app referred to by this class 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).
The identity associated to the newly added account is in the unverified state, so that the actual user
cannot authenticate with this identity until it has been verified. To to so, the user receives a verification
code or token on the specified msisdn ("phone" method) or email address ("password" method), which must be sent
back to the Webcom backend using the Webcom.verifyIdentity
method.
provider
- The authentication method required by the identity associated to the added account. Possiblevalues are "password"
or "phone"
details
- The details of the identity associated to the added account (depends on the chosen authenticationmethod)messageDetails
- Settings of the message to be sent to the user to verify her/his identitycallback
- The callback notified when:class Webcom
,
Webcom.verifyIdentity
@Deprecated public void addAccount(@NotNull java.lang.String provider, @NotNull AuthDetails details, @Nullable MessageDetails messageDetails, @Nullable OnAuth callback)
public void addIdentity(@NotNull java.lang.String provider, @NotNull AuthDetails details, @NotNull OnAuth callback)
Adds a new account to the app referred to by this class Webcom
instance.
See Webcom.addIdentity
.
provider
- The authentication method required by the identity associated to the added account. Possiblevalues are "password"
or "phone"
details
- The details of the identity associated to the added account (depends on the chosen authenticationmethod)callback
- The callback notified when:class Webcom
,
Webcom.addIdentity
@Deprecated public void addAccount(@NotNull java.lang.String provider, @NotNull AuthDetails details, @NotNull OnAuth callback)
public void verifyIdentity(@NotNull java.lang.String provider, @NotNull java.lang.String id, @NotNull VerificationData data, @NotNull OnAuth callback)
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.
provider
- The authentication method associated to the identity to verify. Possible values are "password"
or "phone"
id
- The identifier to use to authenticate a user with the identity to verify (typically an msisdn or anemail address)data
- The verification data needed by the Webcom backend to verify the identity. It must include the codeor token received by the usercallback
- The callback notified when:Webcom.addIdentity
public void wakeupSubscribe(@NotNull java.lang.String id, @NotNull java.lang.String mode, @Nullable OnComplete callback)
public void wakeupSubscribe(@NotNull java.lang.String id, @Nullable OnComplete callback)
public void wakeupUnsubscribe(@NotNull java.lang.String id, @Nullable OnComplete callback)
public void subscribe(@NotNull java.lang.Object jsDescriptor, @NotNull java.lang.Object jsTarget, @NotNull OnValue callback)
public void unsubscribe(@NotNull java.lang.Object jsTarget, @Nullable OnValue callback)
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull NotificationEvent event, boolean receiveRevocations, @Nullable java.util.Date expiration, @NotNull OnComplete callback)
Subscribes to a given enum NotificationEvent
on the current data node path, to be received through push mobile
notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)event
- The subscribed event.receiveRevocations
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.expiration
- If set, the subscription will automatically cancel at the given date, otherwise it will berevoked by the server after the default delay set in the Webcom developer console.callback
- The callback called when the subscription is acknowledged by the server.enum NotificationEvent
,
deviceId
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull NotificationEvent event, boolean receiveRevocations, @NotNull OnComplete callback)
Subscribes to a given enum NotificationEvent
on the current data node path, to be received through push mobile
notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)event
- The subscribed event.receiveRevocations
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.callback
- If set, the subscription will automatically cancel at the given date, otherwise it will berevoked by the server after the default delay set in the Webcom developer console.enum NotificationEvent
,
deviceId
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull NotificationEvent event, @NotNull OnComplete callback)
Subscribes to a given enum NotificationEvent
on the current data node path, to be received through push mobile
notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)event
- The subscribed event.callback
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.enum NotificationEvent
,
deviceId
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events, boolean receiveRevocations, @Nullable java.util.Date expiration, @NotNull OnComplete callback)
Subscribes to a given set of enum NotificationEvent
s on the current data node path, to be received through push
mobile notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)events
- The list of subscribed events.receiveRevocations
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.expiration
- If set, the subscription will automatically cancel at the given date, otherwise it will berevoked by the server after the default delay set in the Webcom developer console.callback
- The callback called when the subscription is acknowledged by the server.enum NotificationEvent
,
deviceId
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events, boolean receiveRevocations, @NotNull OnComplete callback)
Subscribes to a given set of enum NotificationEvent
s on the current data node path, to be received through push
mobile notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)events
- The list of subscribed events.receiveRevocations
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.callback
- If set, the subscription will automatically cancel at the given date, otherwise it will berevoked by the server after the default delay set in the Webcom developer console.enum NotificationEvent
,
deviceId
@JvmOverloads public void subscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @NotNull java.util.EnumSet<com.orange.webcom.sdk.NotificationEvent> events, @NotNull OnComplete callback)
Subscribes to a given set of enum NotificationEvent
s on the current data node path, to be received through push
mobile notifications sent to a given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to send the notifications (to be retrieved using the FCM libraries)events
- The list of subscribed events.callback
- If true
(default value) the revocation of the subscription by the server will alsobe sent to the device through a push mobile notification.enum NotificationEvent
,
deviceId
@JvmOverloads public void unsubscribeWithMobileNotifications(@NotNull java.lang.String deviceId, @Nullable OnComplete callback)
Unsubscribes from enum NotificationEvent
s on the current data node path, so that no longer push mobile notifications
are sent to the given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to stop sending notifications (to be retrieved using the FCMlibraries).callback
- The callback called when the unsubscription is acknowledged by the server.enum NotificationEvent
,
deviceId
@JvmOverloads public void unsubscribeWithMobileNotifications(@NotNull java.lang.String deviceId)
Unsubscribes from enum NotificationEvent
s on the current data node path, so that no longer push mobile notifications
are sent to the given deviceId
. This operation requires to be authenticated.
deviceId
- The device identifier where to stop sending notifications (to be retrieved using the FCMlibraries).enum NotificationEvent
,
deviceId
public boolean shouldBeOnline()
Returns the working status of the Datasync service associated with this instance wrt. to the network connection.
true
means that the Datasync service is either connected to the Webcom backend or is trying to do so as soon
as the network connectivity is available.
false
means that the Datasync service is deliberately disconnected from the Webcom backend (even if network
connectivity is available).
The working status wrt. the network connection may be switched on or off using the goOnline
and goOffline
methods.
@NotNull public OnDisconnect onDisconnect()
@JvmOverloads public void transaction(@NotNull TransactionCallback callbacks, boolean applyLocally)
@JvmOverloads public void transaction(@NotNull TransactionCallback callbacks)
public void useCurrentContextForNextAuthOperation()
public void useNewContextForNextAuthOperation()
@NotNull public java.lang.String toString()
@Nullable public java.lang.Object internalRepresentation()
@JvmStatic public static void onReady(@NotNull java.lang.Runnable runnable)
Registers the runnable
callback to be called as soon as the Webcom SDK has completed its initialization.
No instance of the class Webcom
can be created before the completion of the SDK initialization.
Calling any of its constructors is safe as soon as any of the registered callbacks has been called.
If the initialization is already complete when calling this method, the given callback is called immediately.
runnable
,
class Webcom
,
waitForReady