當前位置: 首頁>>代碼示例>>Java>>正文


Java OperationCanceledException類代碼示例

本文整理匯總了Java中android.accounts.OperationCanceledException的典型用法代碼示例。如果您正苦於以下問題:Java OperationCanceledException類的具體用法?Java OperationCanceledException怎麽用?Java OperationCanceledException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OperationCanceledException類屬於android.accounts包,在下文中一共展示了OperationCanceledException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: syncLogon4LetvPhone

import android.accounts.OperationCanceledException; //導入依賴的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.OperationCanceledException; //導入依賴的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: addNewAccount

import android.accounts.OperationCanceledException; //導入依賴的package包/類
private void addNewAccount() {
    mAccountManager.addAccount(EnlightnsAccountAuthenticator.ACCOUNT_TYPE,
            EnlightnsAccountAuthenticator.AUTH_TOKEN_TYPE, null, null, this, new AccountManagerCallback<Bundle>() {
                @Override
                public void run(AccountManagerFuture<Bundle> future) {
                    try {
                        Bundle bnd = future.getResult();
                        showMessage(getString(R.string.successful_login_toast));
                        new GetUserRecordsTask().execute();
                        Log.d(TAG, "AddNewAccount Bundle is " + bnd);
                    } catch (OperationCanceledException oce) {
                        Log.d(TAG, "Operation cancelled, no account available, exiting...", oce);
                        finish();
                    } catch (Exception e) {
                        Log.w(TAG, "Exception", e);
                        showMessage(getString(R.string.login_error));
                    }
                }
            }, null);
}
 
開發者ID:EnlightNS,項目名稱:enlightns-android,代碼行數:21,代碼來源:RecordListing.java

示例4: onPerformSync

import android.accounts.OperationCanceledException; //導入依賴的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.OperationCanceledException; //導入依賴的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

示例6: run

import android.accounts.OperationCanceledException; //導入依賴的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

示例7: getToken

import android.accounts.OperationCanceledException; //導入依賴的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

示例8: createAccountAndGetToken

import android.accounts.OperationCanceledException; //導入依賴的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

示例9: getToken

import android.accounts.OperationCanceledException; //導入依賴的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

示例10: getClientFor

import android.accounts.OperationCanceledException; //導入依賴的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

示例11: saveAllClients

import android.accounts.OperationCanceledException; //導入依賴的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

示例12: getQuestions

import android.accounts.OperationCanceledException; //導入依賴的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

示例13: uploadImage

import android.accounts.OperationCanceledException; //導入依賴的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

示例14: run

import android.accounts.OperationCanceledException; //導入依賴的package包/類
@Override
public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
    try {
        Bundle result = bundleAccountManagerFuture.getResult();
        Intent intent = (Intent) result.get(AccountManager.KEY_INTENT);
        if (intent == null) {
            String authToken = result.getString(AccountManager.KEY_AUTHTOKEN);
            GutenbergApplication app = GutenbergApplication.from(BaseActivity.this);
            app.setAuthToken(authToken);
            app.requestSync(false);
        } else {
            startActivityForResult(intent, REQUEST_AUTHENTICATE);
        }
    } catch (OperationCanceledException | IOException | AuthenticatorException e) {
        Log.e(TAG, "Error authenticating.", e);
    }
}
 
開發者ID:googlesamples,項目名稱:attendee-checkin,代碼行數:18,代碼來源:BaseActivity.java

示例15: addAccount

import android.accounts.OperationCanceledException; //導入依賴的package包/類
private void addAccount(String accountName) {
    AccountManager accountManager = AccountManager.get(this);
    Bundle bundle = new Bundle();
    if (!TextUtils.isEmpty(accountName)) {
        bundle.putString(AccountManager.KEY_ACCOUNT_NAME, accountName);
    }

    accountManager.addAccount(GOOGLE_ACCOUNT_TYPE, null, null, bundle, this,
            accountManagerFuture -> {
                try {
                    Bundle result = accountManagerFuture.getResult();
                    String accountNameAdded = result.getString(AccountManager.KEY_ACCOUNT_NAME);
                    Log.d(TAG, "addAccount - accountNameAdded: " + accountNameAdded);
                    if (mNextActivityIntent != null) {
                        startActivity(mNextActivityIntent);
                    }
                    finish();
                } catch (OperationCanceledException | AuthenticatorException
                        | IOException e) {
                    Log.e(TAG, "addAccount - failed", e);
                    Toast.makeText(AddAccountActivity.this,
                            R.string.fail_to_add_account, Toast.LENGTH_LONG).show();
                }
            }, null);
}
 
開發者ID:googlesamples,項目名稱:android-testdpc,代碼行數:26,代碼來源:AddAccountActivity.java


注:本文中的android.accounts.OperationCanceledException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。