List of usage examples for android.accounts AccountManager getAccountsByTypeAndFeatures
public AccountManagerFuture<Account[]> getAccountsByTypeAndFeatures(final String type, final String[] features, AccountManagerCallback<Account[]> callback, Handler handler)
From source file:com.ocp.picasa.PicasaApi.java
public static Account[] getAccounts(Context context) { // Return the list of accounts supporting the Picasa GData service. AccountManager accountManager = AccountManager.get(context); Account[] accounts = {};//www . j a va 2 s . c o m try { accounts = accountManager.getAccountsByTypeAndFeatures(PicasaService.ACCOUNT_TYPE, new String[] { PicasaService.FEATURE_SERVICE_NAME }, null, null).getResult(); } catch (OperationCanceledException e) { } catch (AuthenticatorException e) { } catch (IOException e) { } catch (Exception e) { ; } return accounts; }
From source file:com.hemou.android.account.AccountUtils.java
private static Account[] getAccounts(final AccountManager manager) throws OperationCanceledException, AuthenticatorException, IOException { final AccountManagerFuture<Account[]> future = manager.getAccountsByTypeAndFeatures(ACCOUNT_TYPE, null, null, null);//w ww . ja va 2s . c om final Account[] accounts = future.getResult(); if (accounts != null && accounts.length > 0) return getPasswordAccessibleAccounts(manager, accounts); else return new Account[0]; }
From source file:org.jnrain.mobile.ui.MainActivity.java
public void initAccount() { // TODO: move this code out to accounts package if (GlobalState.getAccount() == null) { // prevent infinite recursion GlobalState.incrementAccountInitLevel(); new AsyncTask<Void, Void, Void>() { @Override/*ww w .ja v a2 s . c o m*/ protected Void doInBackground(Void... arg0) { AccountManager am = AccountManager.get(getThisActivity()); am.getAccountsByTypeAndFeatures(AccountConstants.ACCOUNT_TYPE_KBS, null, MainActivity.this, null); return null; } }.execute((Void) null); } }