Example usage for android.accounts AccountManagerCallback AccountManagerCallback

List of usage examples for android.accounts AccountManagerCallback AccountManagerCallback

Introduction

In this page you can find the example usage for android.accounts AccountManagerCallback AccountManagerCallback.

Prototype

AccountManagerCallback

Source Link

Usage

From source file:com.capstonecontrol.AccountsActivity.java

/**
 * Registers for C2DM messaging with the given account name.
 * //from   w w  w .  j  a v a  2  s  .  com
 * @param accountName
 *            a String containing a Google account name
 */
private void register(final String accountName) {
    // Store the account name in shared preferences
    final SharedPreferences prefs = Util.getSharedPreferences(mContext);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString(Util.ACCOUNT_NAME, accountName);
    editor.remove(Util.AUTH_COOKIE);
    editor.remove(Util.DEVICE_REGISTRATION_ID);
    editor.commit();

    // Obtain an auth token and register
    final AccountManager mgr = AccountManager.get(mContext);
    Account[] accts = mgr.getAccountsByType("com.google");
    for (Account acct : accts) {
        final Account account = acct;
        if (account.name.equals(accountName)) {
            if (Util.isDebug(mContext)) {
                // Use a fake cookie for the dev mode app engine server
                // The cookie has the form email:isAdmin:userId
                // We set the userId to be the same as the email
                String authCookie = "dev_appserver_login=" + accountName + ":false:" + accountName;
                prefs.edit().putString(Util.AUTH_COOKIE, authCookie).commit();
                C2DMessaging.register(mContext, Setup.SENDER_ID);
            } else {
                // Get the auth token from the AccountManager and convert
                // it into a cookie for the appengine server
                final Activity activity = this;
                mgr.getAuthToken(account, "ah", null, activity, new AccountManagerCallback<Bundle>() {
                    public void run(AccountManagerFuture<Bundle> future) {
                        String authToken = getAuthToken(future);
                        // Ensure the token is not expired by
                        // invalidating it and
                        // obtaining a new one
                        mgr.invalidateAuthToken(account.type, authToken);
                        mgr.getAuthToken(account, "ah", null, activity, new AccountManagerCallback<Bundle>() {
                            public void run(AccountManagerFuture<Bundle> future) {
                                String authToken = getAuthToken(future);
                                // Convert the token into a
                                // cookie for future use
                                String authCookie = getAuthCookie(authToken);
                                Editor editor = prefs.edit();
                                editor.putString(Util.AUTH_COOKIE, authCookie);
                                editor.commit();
                                C2DMessaging.register(mContext, Setup.SENDER_ID);
                            }
                        }, null);
                    }
                }, null);
            }
            break;
        }
    }
}

From source file:com.nest5.businessClient.AccountsActivity.java

/**
 * Registers for C2DM messaging with the given account name.
 * //from ww w.ja va2s .  co m
 * @param accountName a String containing a Google account name
 */
private void register(final String accountName) {
    // Store the account name in shared preferences
    final SharedPreferences prefs = Util.getSharedPreferences(mContext);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString(Util.ACCOUNT_NAME, accountName);
    editor.remove(Util.AUTH_COOKIE);
    editor.remove(Util.DEVICE_REGISTRATION_ID);
    editor.commit();

    // Obtain an auth token and register
    final AccountManager mgr = AccountManager.get(mContext);
    Account[] accts = mgr.getAccountsByType("com.google");
    for (Account acct : accts) {
        final Account account = acct;
        if (account.name.equals(accountName)) {

            // Get the auth token from the AccountManager and convert
            // it into a cookie for the appengine server
            final Activity activity = this;
            mgr.getAuthToken(account, "ah", null, activity, new AccountManagerCallback<Bundle>() {
                public void run(AccountManagerFuture<Bundle> future) {
                    String authToken = getAuthToken(future);
                    // Ensure the token is not expired by invalidating it and
                    // obtaining a new one
                    mgr.invalidateAuthToken(account.type, authToken);
                    mgr.getAuthToken(account, "ah", null, activity, new AccountManagerCallback<Bundle>() {
                        public void run(AccountManagerFuture<Bundle> future) {
                            String authToken = getAuthToken(future);
                            // Convert the token into a cookie for future use
                            String authCookie = getAuthCookie(authToken);
                            Editor editor = prefs.edit();
                            editor.putString(Util.AUTH_COOKIE, authCookie);
                            editor.commit();
                            C2DMessaging.register(mContext, Setup.SENDER_ID);
                        }
                    }, null);
                }
            }, null);

            break;
        }
    }
}

From source file:com.google.ipc.invalidation.ticl.android.AndroidChannel.java

/**
 * Initiates acquisition of an authentication token that can be used with channel HTTP requests.
 * Android token acquisition is asynchronous since it may require HTTP interactions with the
 * ClientLogin servers to obtain the token.
 *//*from  www  . ja v a  2s  .com*/
@SuppressWarnings("deprecation")

synchronized void requestAuthToken(final CompletionCallback callback) {
    // If there is currently no token and no pending request, initiate one.
    if (disableAccountManager) {
        logger.fine("Not requesting auth token since account manager disabled");
        return;
    }
    if (authToken == null) {
        // Ask the AccountManager for the token, with a pending future to store it on the channel
        // once available.
        final AndroidChannel theChannel = this;
        AccountManager accountManager = AccountManager.get(proxy.getService());
        accountManager.getAuthToken(proxy.getAccount(), proxy.getAuthType(), true,
                new AccountManagerCallback<Bundle>() {
                    @Override
                    public void run(AccountManagerFuture<Bundle> future) {
                        try {
                            Bundle result = future.getResult();
                            if (result.containsKey(AccountManager.KEY_INTENT)) {
                                // TODO: Handle case where there are no authentication
                                // credentials associated with the client account
                                logger.severe("Token acquisition requires user login");
                                callback.success(); // No further retries.
                            }
                            setAuthToken(result.getString(AccountManager.KEY_AUTHTOKEN));
                        } catch (OperationCanceledException exception) {
                            logger.warning("Auth cancelled", exception);
                            // TODO: Send error to client
                        } catch (AuthenticatorException exception) {
                            logger.warning("Auth error acquiring token", exception);
                            callback.failure();
                        } catch (IOException exception) {
                            logger.warning("IO Exception acquiring token", exception);
                            callback.failure();
                        }
                    }
                }, null);
    } else {
        logger.fine("Auth token request already pending");
        callback.success();
    }
}

From source file:org.mozilla.gecko.sync.syncadapter.SyncAdapter.java

@Override
public void onPerformSync(final Account account, final Bundle extras, final String authority,
        final ContentProviderClient provider, final SyncResult syncResult) {
    Utils.reseedSharedRandom(); // Make sure we don't work with the same random seed for too long.

    boolean force = (extras != null) && (extras.getBoolean("force", false));
    long delay = delayMilliseconds();
    if (delay > 0) {
        if (force) {
            Log.i(LOG_TAG, "Forced sync: overruling remaining backoff of " + delay + "ms.");
        } else {/* w ww  .ja  va 2  s .  c om*/
            Log.i(LOG_TAG, "Not syncing: must wait another " + delay + "ms.");
            long remainingSeconds = delay / 1000;
            syncResult.delayUntil = remainingSeconds + BACKOFF_PAD_SECONDS;
            return;
        }
    }

    // TODO: don't clear the auth token unless we have a sync error.
    Log.i(LOG_TAG, "Got onPerformSync. Extras bundle is " + extras);
    Log.i(LOG_TAG, "Account name: " + account.name);

    // TODO: don't always invalidate; use getShouldInvalidateAuthToken.
    // However, this fixes Bug 716815, so it'll do for now.
    Log.d(LOG_TAG, "Invalidating auth token.");
    invalidateAuthToken(account);

    final SyncAdapter self = this;
    final AccountManagerCallback<Bundle> callback = new AccountManagerCallback<Bundle>() {
        @Override
        public void run(AccountManagerFuture<Bundle> future) {
            Log.i(LOG_TAG, "AccountManagerCallback invoked.");
            // TODO: N.B.: Future must not be used on the main thread.
            try {
                Bundle bundle = future.getResult(60L, TimeUnit.SECONDS);
                if (bundle.containsKey("KEY_INTENT")) {
                    Log.w(LOG_TAG, "KEY_INTENT included in AccountManagerFuture bundle. Problem?");
                }
                String username = bundle.getString(Constants.OPTION_USERNAME);
                String syncKey = bundle.getString(Constants.OPTION_SYNCKEY);
                String serverURL = bundle.getString(Constants.OPTION_SERVER);
                String password = bundle.getString(AccountManager.KEY_AUTHTOKEN);
                Log.d(LOG_TAG, "Username: " + username);
                Log.d(LOG_TAG, "Server:   " + serverURL);
                Log.d(LOG_TAG, "Password? " + (password != null));
                Log.d(LOG_TAG, "Key?      " + (syncKey != null));
                if (password == null) {
                    Log.e(LOG_TAG, "No password: aborting sync.");
                    syncResult.stats.numAuthExceptions++;
                    notifyMonitor();
                    return;
                }
                if (syncKey == null) {
                    Log.e(LOG_TAG, "No Sync Key: aborting sync.");
                    syncResult.stats.numAuthExceptions++;
                    notifyMonitor();
                    return;
                }
                KeyBundle keyBundle = new KeyBundle(username, syncKey);

                // Support multiple accounts by mapping each server/account pair to a branch of the
                // shared preferences space.
                String prefsPath = Utils.getPrefsPath(username, serverURL);
                self.performSync(account, extras, authority, provider, syncResult, username, password,
                        prefsPath, serverURL, keyBundle);
            } catch (Exception e) {
                self.handleException(e, syncResult);
                return;
            }
        }
    };

    final Handler handler = null;
    final Runnable fetchAuthToken = new Runnable() {
        @Override
        public void run() {
            getAuthToken(account, callback, handler);
        }
    };
    synchronized (syncMonitor) {
        // Perform the work in a new thread from within this synchronized block,
        // which allows us to be waiting on the monitor before the callback can
        // notify us in a failure case. Oh, concurrent programming.
        new Thread(fetchAuthToken).start();

        Log.i(LOG_TAG, "Waiting on sync monitor.");
        try {
            syncMonitor.wait();
            long next = System.currentTimeMillis() + MINIMUM_SYNC_INTERVAL_MILLISECONDS;
            Log.i(LOG_TAG, "Setting minimum next sync time to " + next);
            extendEarliestNextSync(next);
        } catch (InterruptedException e) {
            Log.i(LOG_TAG, "Waiting on sync monitor interrupted.", e);
        }
    }
}

From source file:com.he5ed.lib.cloudprovider.apis.CloudDriveApi.java

@Override
public synchronized void prepareApi(BaseApi.OnPrepareListener prepareListener) {
    mPrepareListener = prepareListener;/*from  w w w . j ava  2s . c  o  m*/

    AccountManager.get(mContext).getAuthToken(mAccount, CloudProvider.AUTH_TYPE, false,
            new AccountManagerCallback<Bundle>() {
                @Override
                public void run(AccountManagerFuture<Bundle> future) {
                    try {
                        mAccessToken = future.getResult().getString(AccountManager.KEY_AUTHTOKEN);

                        validateAccessToken();
                    } catch (OperationCanceledException e) {
                        e.printStackTrace();
                        Log.e(TAG, e.getMessage());
                        if (mPrepareListener != null)
                            mPrepareListener.onPrepareFail(e);
                    } catch (IOException e) {
                        e.printStackTrace();
                        Log.e(TAG, e.getMessage());
                        if (mPrepareListener != null)
                            mPrepareListener.onPrepareFail(e);
                    } catch (AuthenticatorException e) {
                        e.printStackTrace();
                        Log.e(TAG, e.getMessage());
                        if (mPrepareListener != null)
                            mPrepareListener.onPrepareFail(e);
                    }
                }
            }, null);
}

From source file:com.myandroidremote.AccountsActivity.java

/**
 * Registers for C2DM messaging with the given account name.
 * /* w ww.j  av a  2  s  .  c  om*/
 * @param accountName
 *            a String containing a Google account name
 */
private void register(final String accountName) {
    // Store the account name in shared preferences
    final SharedPreferences prefs = Util.getSharedPreferences(mContext);
    SharedPreferences.Editor editor = prefs.edit();
    editor.putString(Util.ACCOUNT_NAME, accountName);
    editor.putString(Util.AUTH_COOKIE, null);
    editor.commit();

    // Obtain an auth token and register
    final AccountManager mgr = AccountManager.get(mContext);
    Account[] accts = mgr.getAccountsByType("com.google");
    for (Account acct : accts) {
        if (acct.name.equals(accountName)) {
            if (Util.isDebug(mContext)) {
                // Use a fake cookie for the dev mode app engine server
                // The cookie has the form email:isAdmin:userId
                // We set the userId to be the same as the account name
                String authCookie = "dev_appserver_login=" + accountName + ":false:" + accountName;
                boolean result = prefs.edit().putString(Util.AUTH_COOKIE, authCookie).commit();
                C2DMessaging.register(mContext, Setup.SENDER_ID);
            } else {
                // Get the auth token from the AccountManager and convert
                // it into a cookie for the appengine server
                mgr.getAuthToken(acct, "ah", null, this, new AccountManagerCallback<Bundle>() {
                    public void run(AccountManagerFuture<Bundle> future) {
                        try {
                            Bundle authTokenBundle = future.getResult();
                            String authToken = authTokenBundle.get(AccountManager.KEY_AUTHTOKEN).toString();
                            String authCookie = getAuthCookie(authToken);
                            if (authCookie == null) {
                                mgr.invalidateAuthToken("com.google", authToken);
                            }
                            prefs.edit().putString(Util.AUTH_COOKIE, authCookie).commit();

                            C2DMessaging.register(mContext, Setup.SENDER_ID);
                        } catch (AuthenticatorException e) {
                            Log.w(TAG, "Got AuthenticatorException " + e);
                            Log.w(TAG, Log.getStackTraceString(e));
                        } catch (IOException e) {
                            Log.w(TAG, "Got IOException " + Log.getStackTraceString(e));
                            Log.w(TAG, Log.getStackTraceString(e));
                        } catch (OperationCanceledException e) {
                            Log.w(TAG, "Got OperationCanceledException " + e);
                            Log.w(TAG, Log.getStackTraceString(e));
                        }
                    }
                }, null);
            }
            break;
        }
    }
}

From source file:com.activiti.android.app.fragments.settings.AccountSettingsFragment.java

private void deleteAccount() {
    progressdialog = new MaterialDialog.Builder(getActivity()).title(R.string.account_remove_progress)
            .content(R.string.please_wait).progress(true, 0).cancelable(false).show();

    // Detect if latest account
    List<ActivitiAccount> accounts = ActivitiAccountManager.retrieveAccounts(getActivity());
    if (accounts.size() == 1) {
        // Latest account
        isLatest = true;/*from  w  w w  .  j  av  a  2  s . com*/
    } else {
        // Prepare the next account to load
        isLatest = false;
    }

    // Clean Providers
    AccountsPreferences.clear(getActivity());
    InternalAppPreferences.clean(getActivity(), accountId);

    // Clean Providers
    RuntimeAppInstanceManager.getInstance(getActivity()).deleteByAccountId(accountId);
    IntegrationManager.getInstance(getActivity()).deleteByAccountId(accountId);
    GroupInstanceManager.getInstance(getActivity()).deleteByAccountId(accountId);
    ProcessDefinitionModelManager.getInstance(getActivity()).deleteByAccountId(accountId);

    // Delete Account
    ActivitiAccountManager.getInstance(getActivity()).delete(getActivity(), accountId,
            new AccountManagerCallback<Boolean>() {
                @Override
                public void run(AccountManagerFuture<Boolean> future) {
                    // Clean Providers
                    ActivitiAccount currentAccount = AccountsPreferences.getDefaultAccount(getActivity());

                    if (isLatest) {
                        getActivity().startActivity(new Intent(getActivity(), WelcomeActivity.class));
                        getActivity().finish();
                    } else {
                        if (getActivity() instanceof MainActivity) {
                            ((MainActivity) getActivity()).switchAccount(currentAccount);
                        }
                    }
                    progressdialog.dismiss();
                }
            });
}

From source file:org.creativecommons.thelist.utils.ListUser.java

/**
 * Show all the accounts registered on the account manager. Request an auth token upon user select.
 *///from ww w  .  j  a v a2 s.c o  m
public void showAccountPicker(final AuthCallback callback) {
    //@param final boolean invalidate, final String authTokenType // mInvalidate = invalidate;
    final Account availableAccounts[] = am.getAccountsByType(AccountGeneral.ACCOUNT_TYPE);

    if (availableAccounts.length == 0) {
        //TODO: Show other dialog to add account
        addNewAccount(AccountGeneral.ACCOUNT_TYPE, AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS,
                new AuthCallback() {
                    @Override
                    public void onSuccess(String authtoken) {
                        Log.d(TAG, " > showAccountPicker (no accounts) > addNewAccount, " + "token received: "
                                + authtoken);
                    }
                });
    } else {
        String name[] = new String[availableAccounts.length];
        for (int i = 0; i < availableAccounts.length; i++) {
            name[i] = availableAccounts[i].name;
        }

        // Account picker
        mAlertDialog = new AlertDialog.Builder(mContext).setTitle("Pick Account").setCancelable(true)
                .setPositiveButton("Add New", new OkOnClickListener())
                .setNegativeButton("Cancel", new CancelOnClickListener())
                .setAdapter(new ArrayAdapter<String>(mContext, android.R.layout.simple_list_item_1, name),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {

                                //                    TODO: do we need this?
                                //                    if(invalidate)
                                //                        invalidateAuthToken(availableAccounts[which], authTokenType);
                                //                    else
                                //                        getExistingAccountAuthToken(availableAccounts[which], authTokenType);

                                am.getAuthToken(availableAccounts[which],
                                        AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS, null, mActivity,
                                        new AccountManagerCallback<Bundle>() {
                                            @Override
                                            public void run(AccountManagerFuture<Bundle> future) {
                                                try {
                                                    Bundle bundle = future.getResult();
                                                    String authtoken = bundle
                                                            .getString(AccountManager.KEY_AUTHTOKEN);
                                                    Log.v(TAG,
                                                            " > showAccountPicker > getAuthToken from existing account: "
                                                                    + authtoken);
                                                    callback.onSuccess(authtoken);
                                                } catch (OperationCanceledException e) {
                                                    e.printStackTrace();
                                                } catch (IOException e) {
                                                    e.printStackTrace();
                                                } catch (AuthenticatorException e) {
                                                    e.printStackTrace();
                                                }
                                            }
                                        }, null);
                            }
                        })
                .create();
        mAlertDialog.show();
    }
}

From source file:com.coloreight.plugin.socialAuth.SocialAuth.java

public void getTwitterSystemAccount(final String networkUserName, final CallbackContext callbackContext) {
    cordova.getThreadPool().execute(new Runnable() {
        public void run() {

            PluginResult pluginResult;/* ww w . j  a v a 2s.  c  o m*/
            final JSONObject json = new JSONObject();
            final JSONObject account = new JSONObject();

            final Account[] twitterAccounts = accountManager
                    .getAccountsByType("com.twitter.android.auth.login");

            try {
                if (twitterAccounts.length > 0) {
                    json.put("granted", true);

                    for (int i = 0; i < twitterAccounts.length; i++) {
                        if (twitterAccounts[i].name.equals(networkUserName)) {
                            account.put("userName", twitterAccounts[i].name);

                            final Account twitterAccount = twitterAccounts[i];

                            accountManager.getAuthToken(twitterAccount, "com.twitter.android.oauth.token", null,
                                    false, new AccountManagerCallback<Bundle>() {
                                        @Override
                                        public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
                                            try {
                                                Bundle bundle = accountManagerFuture.getResult();

                                                if (bundle.containsKey(AccountManager.KEY_INTENT)) {
                                                    Intent intent = bundle
                                                            .getParcelable(AccountManager.KEY_INTENT);

                                                    //clear the new task flag just in case, since a result is expected
                                                    int flags = intent.getFlags();
                                                    flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
                                                    intent.setFlags(flags);

                                                    requestedTwitterAccountName = networkUserName;

                                                    cordova.getActivity().startActivityForResult(intent,
                                                            TWITTER_OAUTH_REQUEST);
                                                } else {
                                                    account.put("oauth_token",
                                                            bundle.getString(AccountManager.KEY_AUTHTOKEN));

                                                    accountManager.getAuthToken(twitterAccount,
                                                            "com.twitter.android.oauth.token.secret", null,
                                                            false, new AccountManagerCallback<Bundle>() {
                                                                @Override
                                                                public void run(
                                                                        AccountManagerFuture<Bundle> accountManagerFuture) {
                                                                    try {
                                                                        Bundle bundle = accountManagerFuture
                                                                                .getResult();

                                                                        if (bundle.containsKey(
                                                                                AccountManager.KEY_INTENT)) {
                                                                            Intent intent = bundle
                                                                                    .getParcelable(
                                                                                            AccountManager.KEY_INTENT);

                                                                            //clear the new task flag just in case, since a result is expected
                                                                            int flags = intent.getFlags();
                                                                            flags &= ~Intent.FLAG_ACTIVITY_NEW_TASK;
                                                                            intent.setFlags(flags);

                                                                            requestedTwitterAccountName = networkUserName;

                                                                            cordova.getActivity()
                                                                                    .startActivityForResult(
                                                                                            intent,
                                                                                            TWITTER_OAUTH_REQUEST);
                                                                        } else {
                                                                            account.put("oauth_token_secret",
                                                                                    bundle.getString(
                                                                                            AccountManager.KEY_AUTHTOKEN));

                                                                            json.put("data", account);

                                                                            Log.v(TAG, "Account data: "
                                                                                    + json.toString());

                                                                            PluginResult pluginResult = new PluginResult(
                                                                                    PluginResult.Status.OK,
                                                                                    json);
                                                                            pluginResult.setKeepCallback(true);
                                                                            callbackContext.sendPluginResult(
                                                                                    pluginResult);
                                                                        }

                                                                    } catch (Exception e) {
                                                                        PluginResult pluginResult = new PluginResult(
                                                                                PluginResult.Status.ERROR,
                                                                                e.getLocalizedMessage());
                                                                        pluginResult.setKeepCallback(true);
                                                                        callbackContext
                                                                                .sendPluginResult(pluginResult);
                                                                    }
                                                                }
                                                            }, null);
                                                }

                                            } catch (Exception e) {
                                                PluginResult pluginResult = new PluginResult(
                                                        PluginResult.Status.ERROR, e.getLocalizedMessage());
                                                pluginResult.setKeepCallback(true);
                                                callbackContext.sendPluginResult(pluginResult);
                                            }
                                        }
                                    }, null);
                        }
                    }
                } else {
                    json.put("code", "0");
                    json.put("message", "no have twitter accounts");

                    pluginResult = new PluginResult(PluginResult.Status.ERROR, json);
                    pluginResult.setKeepCallback(true);
                    callbackContext.sendPluginResult(pluginResult);
                }
            } catch (JSONException e) {
                pluginResult = new PluginResult(PluginResult.Status.ERROR, e.getLocalizedMessage());
                pluginResult.setKeepCallback(true);
                callbackContext.sendPluginResult(pluginResult);
            }
        }
    });
}

From source file:com.jedi.setupwizard.ui.SetupWizardActivity.java

public void launchGoogleAccountSetup() {
    Bundle bundle = new Bundle();
    bundle.putBoolean(SetupWizard.EXTRA_FIRST_RUN, true);
    bundle.putBoolean(SetupWizard.EXTRA_ALLOW_SKIP, true);
    AccountManager.get(this).addAccount(SetupWizard.ACCOUNT_TYPE_GOOGLE, null, null, bundle, this,
            new AccountManagerCallback<Bundle>() {
                @Override/* ww  w .java  2  s .com*/
                public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) {
                    if (isDestroyed())
                        return; //There is a change this activity has been torn down.
                    String token = null;
                    try {
                        token = bundleAccountManagerFuture.getResult().getString(AccountManager.KEY_AUTHTOKEN);
                        mGoogleAccountSetupComplete = true;
                        Page page = mPageList.findPage(R.string.setup_google_account);
                        if (page != null) {
                            onPageFinished(page);
                        }
                    } catch (OperationCanceledException e) {
                    } catch (IOException e) {
                    } catch (AuthenticatorException e) {
                    }

                }
            }, null);
}