AccountManager.BlockingGetAuthToken(Account, String, Boolean) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
This convenience helper synchronously gets an auth token with
#getAuthToken(Account, String, boolean, AccountManagerCallback, Handler)
.
[Android.Runtime.Register("blockingGetAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Z)Ljava/lang/String;", "GetBlockingGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_ZHandler")]
[Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")]
public virtual string? BlockingGetAuthToken (Android.Accounts.Account? account, string? authTokenType, bool notifyAuthFailure);
[<Android.Runtime.Register("blockingGetAuthToken", "(Landroid/accounts/Account;Ljava/lang/String;Z)Ljava/lang/String;", "GetBlockingGetAuthToken_Landroid_accounts_Account_Ljava_lang_String_ZHandler")>]
[<Android.Runtime.RequiresPermission("android.permission.USE_CREDENTIALS")>]
abstract member BlockingGetAuthToken : Android.Accounts.Account * string * bool -> string
override this.BlockingGetAuthToken : Android.Accounts.Account * string * bool -> string
Parameters
- account
- Account
The account to fetch an auth token for
- authTokenType
- String
The auth token type, see #getAuthToken getAuthToken()
- notifyAuthFailure
- Boolean
If true, display a notification and return null if authentication fails; if false, prompt and wait for the user to re-enter correct credentials before returning
Returns
An auth token of the specified type for this account, or null if authentication fails or none can be fetched.
- Attributes
Exceptions
if the authenticator failed to respond
if the request was canceled for any reason, including the user canceling a credential request
if the authenticator experienced an I/O problem creating a new auth token, usually because of network trouble
Remarks
This convenience helper synchronously gets an auth token with #getAuthToken(Account, String, boolean, AccountManagerCallback, Handler)
.
This method may block while a network request completes, and must never be made from the main thread.
<b>NOTE:</b> If targeting your app to work on API level 22 and before, USE_CREDENTIALS permission is needed for those platforms. See docs for this function in API level 22.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.