当前位置: 首页>>代码示例>>Java>>正文


Java AccountManagerFuture.isCancelled方法代码示例

本文整理汇总了Java中android.accounts.AccountManagerFuture.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java AccountManagerFuture.isCancelled方法的具体用法?Java AccountManagerFuture.isCancelled怎么用?Java AccountManagerFuture.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.accounts.AccountManagerFuture的用法示例。


在下文中一共展示了AccountManagerFuture.isCancelled方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public String getAuthToken() throws AuthFailureError {
    AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:26,代码来源:AndroidAuthenticator.java

示例2: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
public String getAuthToken() throws AuthFailureError {
    AccountManagerFuture<Bundle> future = this.mAccountManager.getAuthToken(this.mAccount, this.mAuthTokenType, this.mNotifyAuthFailure, null, null);
    try {
        Bundle result = (Bundle) future.getResult();
        String authToken = null;
        if (future.isDone() && !future.isCancelled()) {
            if (result.containsKey("intent")) {
                throw new AuthFailureError((Intent) result.getParcelable("intent"));
            }
            authToken = result.getString("authtoken");
        }
        if (authToken != null) {
            return authToken;
        }
        throw new AuthFailureError("Got null auth token for type: " + this.mAuthTokenType);
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:AndroidAuthenticator.java

示例3: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public String getAuthToken() throws AuthFailureError {
    final AccountManager accountManager = AccountManager.get(mContext);
    AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:silicon-mountain,项目名称:smconf-android,代码行数:27,代码来源:AndroidAuthenticator.java

示例4: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation") @Override public String getAuthToken()
        throws AuthFailureError {
    AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType,
            mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:CaMnter,项目名称:SaveVolley,代码行数:25,代码来源:AndroidAuthenticator.java

示例5: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@Override
public String getAuthToken() throws AuthFailureError {
    final AccountManager accountManager = AccountManager.get(mContext);
    AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:active-citizen,项目名称:android.java,代码行数:26,代码来源:AndroidAuthenticator.java

示例6: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public String getAuthToken() throws HttpErrorCollection.AuthFailureError {
    final AccountManager accountManager = AccountManager.get(mContext);
    AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new HttpErrorCollection.AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new HttpErrorCollection.AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new HttpErrorCollection.AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:sddyljsx,项目名称:android-http-lib-based-on-volley,代码行数:27,代码来源:AndroidAuthenticator.java

示例7: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@Override
public String getAuthToken() throws AuthFailureError {
    final AccountManager accountManager = AccountManager.get(mContext);
    AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:goodev,项目名称:android-discourse,代码行数:25,代码来源:AndroidAuthenticator.java

示例8: getToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public String getToken() throws AndroidAuthError {
    AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount,
            mAuthTokenType, mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AndroidAuthError("Error while retrieving auth token", e);
    }
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AndroidAuthError(intent, null);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AndroidAuthError("Got null auth token for type: " +
                mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:apptik,项目名称:jus,代码行数:26,代码来源:AndroidAuthenticator.java

示例9: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@Override
public String getAuthToken() throws AuthFailureError {
    final AccountManager accountManager = AccountManager.get(mContext);
    AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount,
            mAuthTokenType, false, null, null);
    Bundle result;
    try {
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:cnevinc,项目名称:icareyou,代码行数:26,代码来源:AndroidAuthenticator.java

示例10: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@SuppressWarnings("deprecation") @Override public String getAuthToken()
        throws AuthFailureError {
    /*
     * 先通过 Account + tokenType
     * 获取一个 AmsTask<Bundle> ( AccountManagerFuture<Bundle> 的实现类 )
     */
    AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType,
            mNotifyAuthFailure, null, null);
    Bundle result;
    try {
        // 从 AmsTask<Bundle> 抽出出 Bundle 数据
        result = future.getResult();
    } catch (Exception e) {
        throw new AuthFailureError("Error while retrieving auth token", e);
    }
    String authToken = null;
    // 判断 AmsTask<Bundle> 是否正常执行
    if (future.isDone() && !future.isCancelled()) {
        if (result.containsKey(AccountManager.KEY_INTENT)) {
            Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
            throw new AuthFailureError(intent);
        }
        // 拿到认证 token 数据
        authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
    }
    if (authToken == null) {
        throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
    }

    return authToken;
}
 
开发者ID:CaMnter,项目名称:SaveVolley,代码行数:32,代码来源:AndroidAuthenticator.java

示例11: getAuthToken

import android.accounts.AccountManagerFuture; //导入方法依赖的package包/类
@Override
public String getAuthToken() throws AuthFailureError
{
	final AccountManager accountManager = AccountManager.get(mContext);
	AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure,
			null, null);
	Bundle result;
	try
	{
		result = future.getResult();
	}
	catch (Exception e)
	{
		throw new AuthFailureError("Error while retrieving auth token", e);
	}
	String authToken = null;
	if (future.isDone() && !future.isCancelled())
	{
		if (result.containsKey(AccountManager.KEY_INTENT))
		{
			Intent intent = result.getParcelable(AccountManager.KEY_INTENT);
			throw new AuthFailureError(intent);
		}
		authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
	}
	if (authToken == null)
	{
		throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType);
	}

	return authToken;
}
 
开发者ID:himanshuagarwal77225,项目名称:BookMySkills,代码行数:33,代码来源:AndroidAuthenticator.java


注:本文中的android.accounts.AccountManagerFuture.isCancelled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。