當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。