public interface AuthorizationManager
Modifier and Type | Method and Description |
---|---|
CallbackReference |
addAuthorizeCallback(AuthorizeCallback callback)
Adds a callback to handle the result of an authorization attempt.
|
CallbackReference |
addDeauthorizeCallback(DeauthorizeCallback callback)
Adds a callback that handles the result of a deauthorization attempt.
|
void |
authorize(java.lang.String code)
Asynchronously authorizes Reader SDK with a mobile authorization code.
|
void |
deauthorize()
Deauthorizes Reader SDK.
|
AuthorizationState |
getAuthorizationState()
Returns an immutable snapshot of the current authorization state.
|
void authorize(@NonNull java.lang.String code)
Asynchronously authorizes Reader SDK with a mobile authorization code. Applications must authorize Reader SDK before they can collect payments.
Add an AuthorizeCallback
with addAuthorizeCallback(AuthorizeCallback)
to
handle the authorization result.
This method must be called from the main thread.
code
- A mobile authorization code from the Mobile Authorization API.@NonNull CallbackReference addAuthorizeCallback(@NonNull AuthorizeCallback callback)
Adds a callback to handle the result of an authorization attempt.
The callback is executed on the main thread.
callback
- The authorize callback to be added.CallbackReference
. To avoid memory leaks, clear the callback reference with
CallbackReference.clear()
any time a lifecycle destroy event occurs (e.g. Activity.onDestroy()
.authorize(String)
void deauthorize()
AuthorizationState.canDeauthorize()
before calling
this method to avoid errors related to pending uploads.AuthorizationState.canDeauthorize()
@NonNull CallbackReference addDeauthorizeCallback(@NonNull DeauthorizeCallback callback)
Adds a callback that handles the result of a deauthorization attempt.
The callback is executed on the main thread.
callback
- The deauthorize callback to be added.CallbackReference
. To avoid memory leaks, clear the callback reference with
CallbackReference.clear()
any time a lifecycle destroy event occurs (e.g. Activity.onDestroy()
.deauthorize()
@NonNull AuthorizationState getAuthorizationState()
AuthorizationState
will NOT be updated if the state changes.