-
public final class UID2ManagerThis class represents the key way to interact with the UID2 SDK. It is responsible for taking ownership of a given UID2Identity and refreshes it when appropriate.
The consuming application is expected to initialize the manager immediately upon Application creation. This can be done by calling UID2Manager.init. This allows the manager to potentially load any previously stored identity and make sure it's updated accordingly.
After the manager is initialized, updates of the Identity or Status can be done via either the UID2ManagerIdentityChangedListener or via UID2Manager.state.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classUID2Manager.GenerateIdentityResultRepresents the result of a request to generateIdentity.
public classUID2Manager.Companion
-
Field Summary
Fields Modifier and Type Field Description private UID2ManagerIdentityChangedListeneronIdentityChangedListenerprivate Function0<Unit>onInitializedprivate final Flow<UID2ManagerState>stateprivate final UID2IdentitycurrentIdentityprivate final IdentityStatuscurrentIdentityStatusprivate BooleanautomaticRefreshEnabled
-
Method Summary
Modifier and Type Method Description final UID2ManagerIdentityChangedListenergetOnIdentityChangedListener()Gets or sets the listener that will be notified when either the Identity or Identity Status changes. final UnitsetOnIdentityChangedListener(UID2ManagerIdentityChangedListener onIdentityChangedListener)Gets or sets the listener that will be notified when either the Identity or Identity Status changes. final Function0<Unit>getOnInitialized()Gets or sets a listener which can be used to determine if the UID2Manager instance has finished initializing. final UnitsetOnInitialized(Function0<Unit> onInitialized)final Flow<UID2ManagerState>getState()The flow representing the state of the UID2Manager. final UID2IdentitygetCurrentIdentity()final IdentityStatusgetCurrentIdentityStatus()final BooleangetAutomaticRefreshEnabled()Gets or sets whether tha Manager will automatically refresh the Identity. final UnitsetAutomaticRefreshEnabled(Boolean automaticRefreshEnabled)final BooleanhasIdentity()Gets whether or not UID2Manager has a known UID2Identity. final UnitgenerateIdentity(IdentityRequest identityRequest, String subscriptionId, String publicKey, Function1<UID2Manager.GenerateIdentityResult, Unit> onResult)Generates a new identity. final UnitsetIdentity(UID2Identity identity)Sets the current Identity. final UnitresetIdentity()If a valid Identity has been set, this will reset our state along with clearing any persisted data. final UnitrefreshIdentity()Forces a refresh of the current Identity, if set. final StringgetAdvertisingToken()Gets the current Advertising Token, if available. -
-
Method Detail
-
getOnIdentityChangedListener
final UID2ManagerIdentityChangedListener getOnIdentityChangedListener()
Gets or sets the listener that will be notified when either the Identity or Identity Status changes.
-
setOnIdentityChangedListener
final Unit setOnIdentityChangedListener(UID2ManagerIdentityChangedListener onIdentityChangedListener)
Gets or sets the listener that will be notified when either the Identity or Identity Status changes.
-
getOnInitialized
final Function0<Unit> getOnInitialized()
Gets or sets a listener which can be used to determine if the UID2Manager instance has finished initializing. Initializing includes any time required to restore a previously persisted UID2Identity from storage.
If this property is set after initialization is complete, the callback will be invoked immediately.
-
setOnInitialized
final Unit setOnInitialized(Function0<Unit> onInitialized)
-
getState
final Flow<UID2ManagerState> getState()
The flow representing the state of the UID2Manager.
-
getCurrentIdentity
final UID2Identity getCurrentIdentity()
-
getCurrentIdentityStatus
final IdentityStatus getCurrentIdentityStatus()
-
getAutomaticRefreshEnabled
final Boolean getAutomaticRefreshEnabled()
Gets or sets whether tha Manager will automatically refresh the Identity. Setting this to False will cancel any pending refresh.
-
setAutomaticRefreshEnabled
final Unit setAutomaticRefreshEnabled(Boolean automaticRefreshEnabled)
-
hasIdentity
final Boolean hasIdentity()
Gets whether or not UID2Manager has a known UID2Identity. If not, a new identity should be generated either via generateIdentity or generated externally and set via setIdentity.
-
generateIdentity
final Unit generateIdentity(IdentityRequest identityRequest, String subscriptionId, String publicKey, Function1<UID2Manager.GenerateIdentityResult, Unit> onResult)
Generates a new identity.
Once set, assuming it's valid, it will be monitored so that we automatically refresh the token(s) when required. This will also be persisted locally, so that when the application re-launches, we reload this Identity.
- Parameters:
identityRequest- The identify for which the UID2Identity is required for.subscriptionId- The subscription id that was obtained when configuring your account.publicKey- The public key that was obtained when configuring your account.
-
setIdentity
final Unit setIdentity(UID2Identity identity)
Sets the current Identity.
Once set, assuming it's valid, it will be monitored so that we automatically refresh the token(s) when required. This will also be persisted locally, so that when the application re-launches, we reload this Identity.
-
resetIdentity
final Unit resetIdentity()
If a valid Identity has been set, this will reset our state along with clearing any persisted data.
-
refreshIdentity
final Unit refreshIdentity()
Forces a refresh of the current Identity, if set.
-
getAdvertisingToken
final String getAdvertisingToken()
Gets the current Advertising Token, if available.
-
-
-
-