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


Java AuthenticatorException类代码示例

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


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

示例1: syncLogon4LetvPhone

import android.accounts.AuthenticatorException; //导入依赖的package包/类
private void syncLogon4LetvPhone() {
    new Thread() {
        public void run() {
            try {
                String blockingGetAuthToken = LogonManager.this.accountManager.blockingGetAuthToken(LogonManager.this.accounts[0], LogonManager.this.AUTH_TOKEN_TYPE_LETV, true);
                LemallPlatform.getInstance().setSsoToken(blockingGetAuthToken);
                LogonManager.this.syncToken4Logon(blockingGetAuthToken, (IWebviewListener) LogonManager.this.context);
            } catch (OperationCanceledException e) {
                e.printStackTrace();
            } catch (AuthenticatorException e2) {
                e2.printStackTrace();
            } catch (IOException e3) {
                e3.printStackTrace();
            }
        }
    }.start();
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:18,代码来源:LogonManager.java

示例2: doInBackground

import android.accounts.AuthenticatorException; //导入依赖的package包/类
protected Bundle doInBackground(Void... params) {
    try {
        return this.this$0.tryAddXiaomiAccount(this.val$activity);
    } catch (SecurityException e) {
        e.printStackTrace();
        this.retryWebViewWay = true;
        return null;
    } catch (OperationCanceledException e2) {
        e2.printStackTrace();
        return null;
    } catch (AuthenticatorException e3) {
        e3.printStackTrace();
        this.retryWebViewWay = true;
        return null;
    } catch (IOException e4) {
        e4.printStackTrace();
        return null;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:XiaomiOAuthorize$1.java

示例3: convertErrorToException

import android.accounts.AuthenticatorException; //导入依赖的package包/类
private Exception convertErrorToException(int code, String message) {
    if (code == ERROR_CODE_NETWORK_ERROR) {
        return new IOException(message);
    }

    if (code == ERROR_CODE_UNSUPPORTED_OPERATION) {
        return new UnsupportedOperationException(message);
    }

    if (code == ERROR_CODE_INVALID_RESPONSE) {
        return new AuthenticatorException(message);
    }

    if (code == ERROR_CODE_BAD_ARGUMENTS) {
        return new IllegalArgumentException(message);
    }

    return new AuthenticatorException(message);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:20,代码来源:AmsTask.java

示例4: onPerformSync

import android.accounts.AuthenticatorException; //导入依赖的package包/类
@Override
public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {
    try {
        String username = mAccountManager.blockingGetAuthToken(account, AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS, true);

        SyncServerInterface serverInterface = new SyncServerInterface(getContext());
        User user = serverInterface.getUserInfo(username);

        UserContentHelper.clearUsers(getContext());

        if (user != null) {
            UserContentHelper.addUser(getContext(), user);
        }
    } catch (OperationCanceledException | IOException | AuthenticatorException e) {
        e.printStackTrace();
        syncResult.stats.numParseExceptions++;
    }
}
 
开发者ID:heinrichreimer,项目名称:android-wg-planer,代码行数:19,代码来源:UserSyncAdapter.java

示例5: a

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public final void a(Context paramContext, String paramString)
{
  try
  {
    ebf.a(paramContext, paramString);
    return;
  }
  catch (ebg localebg)
  {
    throw new AuthenticatorException("Cannot invalidate token", localebg);
  }
  catch (ebe localebe)
  {
    throw new AuthenticatorException("Cannot invalidate token", localebe);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:fpz.java

示例6: a

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public String a(Context paramContext, String paramString1, String paramString2, boolean paramBoolean)
{
  fpw localfpw = (fpw)mbb.a(paramContext, fpw.class);
  if (paramBoolean) {
    return this.b.a(paramContext, paramString1, paramString2);
  }
  try
  {
    String str = localfpw.a(paramString1, paramString2);
    return str;
  }
  catch (fpv localfpv)
  {
    throw new AuthenticatorException("Recoverable error", localfpv);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:kcn.java

示例7: a

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public Account[] a(String paramString, String[] paramArrayOfString)
{
  try
  {
    Account[] arrayOfAccount = (Account[])AccountManager.get(this.a).getAccountsByTypeAndFeatures(paramString, paramArrayOfString, null, null).getResult(b, TimeUnit.MILLISECONDS);
    return arrayOfAccount;
  }
  catch (AuthenticatorException localAuthenticatorException)
  {
    throw new fpv(localAuthenticatorException);
  }
  catch (OperationCanceledException localOperationCanceledException)
  {
    throw new IOException(localOperationCanceledException);
  }
}
 
开发者ID:ChiangC,项目名称:FMTech,代码行数:17,代码来源:fqa.java

示例8: run

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public void run(AccountManagerFuture<Bundle> result) {
	Bundle bundle;	        
	try {
		bundle = result.getResult();
		Intent intent = (Intent)bundle.get(AccountManager.KEY_INTENT);
		if(intent != null) {
			// User input required
			context.startActivity(intent);
		} else {
           	AccountManager.get(context).invalidateAuthToken(bundle.getString(AccountManager.KEY_ACCOUNT_TYPE), bundle.getString(AccountManager.KEY_AUTHTOKEN));
           	AccountManager.get(context).invalidateAuthToken("ah", bundle.getString(AccountManager.KEY_AUTHTOKEN));
           	onGetAuthToken(bundle);
		}
	} catch (OperationCanceledException | AuthenticatorException | IOException e) {
		//notifyUser(context.getString(R.string.flowzr_sync_error_no_network), 100);
		//showErrorPopup(FlowzrSyncActivity.this, R.string.flowzr_sync_error_no_network);
		//context.setReady();
		e.printStackTrace();
	}
}
 
开发者ID:emmanuel-florent,项目名称:flowzr-android-black,代码行数:21,代码来源:FlowzrBillTask.java

示例9: getToken

import android.accounts.AuthenticatorException; //导入依赖的package包/类
@Override
public AndroidToken getToken(Account account, AndroidTokenType type) throws AuthenticationCanceledException {
    try {
        AndroidToken token;
        Activity activity = activityManager.getActivity();
        if (account == null) {
            token = createAccountAndGetToken(activity, type);
        } else {
            token = getToken(activity, account, type);
        }
        if (token == null) {
            throw new AuthenticationCanceledException("user canceled the login!");
        }
        return token;
    } catch (AuthenticatorException | OperationCanceledException | IOException e) {
        throw new AuthenticationCanceledException(e);
    }
}
 
开发者ID:andretietz,项目名称:retroauth,代码行数:19,代码来源:AndroidTokenStorage.java

示例10: createAccountAndGetToken

import android.accounts.AuthenticatorException; //导入依赖的package包/类
private AndroidToken createAccountAndGetToken(@Nullable Activity activity, @NonNull AndroidTokenType type)
        throws AuthenticatorException, OperationCanceledException, IOException {

    AccountManagerFuture<Bundle> future = accountManager
            .addAccount(type.accountType, type.tokenType, null, null, activity, null, null);
    Bundle result = future.getResult();
    String accountName = result.getString(AccountManager.KEY_ACCOUNT_NAME);
    if (accountName != null) {
        Account account = new Account(result.getString(AccountManager.KEY_ACCOUNT_NAME),
                result.getString(AccountManager.KEY_ACCOUNT_TYPE));
        String token = accountManager.peekAuthToken(account, type.tokenType);
        String refreshToken = accountManager.peekAuthToken(account, getRefreshTokenType(type));
        if (token != null) return new AndroidToken(token, refreshToken);
    }
    return null;
}
 
开发者ID:andretietz,项目名称:retroauth,代码行数:17,代码来源:AndroidTokenStorage.java

示例11: getToken

import android.accounts.AuthenticatorException; //导入依赖的package包/类
@Override
protected Token getToken() throws AuthFailureError {
    String tokenStr;
    try {
        // NOTE: We pass true for notifyAuthFailure for clarity, but our authenticator always
        // assumes it is true, because AccountManager#KEY_NOTIFY_ON_FAILURE is a hidden API.
        tokenStr = mAccountManager.blockingGetAuthToken(
                mAccount, AccountAuthenticator.TOKEN_TYPE_OAUTH, true /* notifyAuthFailure */);
    } catch (AuthenticatorException | OperationCanceledException | IOException e) {
        throw new AuthFailureError("Unable to obtain auth token", e);
    }

    mToken = WireUtil.decodeFromString(tokenStr, Token.class);
    if (mToken == null) {
        throw new AuthFailureError("Error decoding token string");
    }
    return mToken;
}
 
开发者ID:jpd236,项目名称:fantasywear,代码行数:19,代码来源:OAuthApiRequest.java

示例12: getClientFor

import android.accounts.AuthenticatorException; //导入依赖的package包/类
@Override
public OwnCloudClient getClientFor(OwnCloudAccount account, Context context)
           throws AccountNotFoundException, OperationCanceledException, AuthenticatorException,
           IOException {

	Log_OC.d(TAG, "getClientFor(OwnCloudAccount ... : ");

	OwnCloudClient client = OwnCloudClientFactory.createOwnCloudClient(
			account.getBaseUri(), 
			context.getApplicationContext(),
			true);

	Log_OC.v(TAG, "    new client {" +
			(account.getName() != null ?
					account.getName() :
					AccountUtils.buildAccountName(account.getBaseUri(), "")

               ) + ", " + client.hashCode() + "}");

       if (account.getCredentials() == null) {
           account.loadCredentials(context);
       }
       client.setCredentials(account.getCredentials());
	return client;
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:26,代码来源:SimpleFactoryManager.java

示例13: saveAllClients

import android.accounts.AuthenticatorException; //导入依赖的package包/类
@Override
public void saveAllClients(Context context, String accountType)
		throws AccountNotFoundException, AuthenticatorException, IOException,
		OperationCanceledException {

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "Saving sessions... ");
    }

	Iterator<String> accountNames = mClientsWithKnownUsername.keySet().iterator();
	String accountName = null;
	Account account = null;
	while (accountNames.hasNext()) {
		accountName = accountNames.next();
		account = new Account(accountName, accountType);
		AccountUtils.saveClient(
				mClientsWithKnownUsername.get(accountName),
				account, 
				context);
	}

    if (Log.isLoggable(TAG, Log.DEBUG)) {
        Log_OC.d(TAG, "All sessions saved");
    }
}
 
开发者ID:PicFrame,项目名称:picframe,代码行数:26,代码来源:SingleSessionManager.java

示例14: getQuestions

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public JSONObject getQuestions(QuestionsGetRequest request) throws IOException, JSONException, InvalidAccessTokenException, AuthenticatorException, OperationCanceledException, ServerErrorException {
    UrlParams params = new UrlParams();
    params.add("first_question_id", request.getFirstQuestionId());
    params.add("limit", request.getLimit());
    params.add("offset", request.getOffset());
    params.add("tab", request.getContentSection().toString().toLowerCase());
    for (int category : request.getCategories()) {
        params.add("categories[]", category);
    }

    HttpResponse response = makeProtectedGetCall(resolveApiUrl(request.getPath()), params);
    if (response == null || response.getBody() == null) {
        return null;
    }
    return new JSONObject(response.getBody());
}
 
开发者ID:tech-team,项目名称:decider-android,代码行数:17,代码来源:ApiUI.java

示例15: uploadImage

import android.accounts.AuthenticatorException; //导入依赖的package包/类
public JSONObject uploadImage(ImageUploadRequest request) throws JSONException, IOException, InvalidAccessTokenException, AuthenticatorException, OperationCanceledException, ServerErrorException {
    UrlParams params = new UrlParams();
    ImageData image = request.getImage();
    ImageParamFacade imageParamFacade = new ImageParamFacade(image);

    try {
        imageParamFacade.write(params, "image", "preview");

        HttpResponse response = makeProtectedMultipartPostCall(resolveApiUrl(request.getPath()), params);
        if (response == null || response.getBody() == null) {
            return null;
        }
        return new JSONObject(response.getBody());
    } finally {
        imageParamFacade.close();
    }
}
 
开发者ID:tech-team,项目名称:decider-android,代码行数:18,代码来源:ApiUI.java


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