Example usage for android.provider Settings EXTRA_ACCOUNT_TYPES

List of usage examples for android.provider Settings EXTRA_ACCOUNT_TYPES

Introduction

In this page you can find the example usage for android.provider Settings EXTRA_ACCOUNT_TYPES.

Prototype

String EXTRA_ACCOUNT_TYPES

To view the source code for android.provider Settings EXTRA_ACCOUNT_TYPES.

Click Source Link

Document

Activity Extra: Limit available options in launched activity based on the given account types.

Usage

From source file:org.voidsink.anewjkuapp.activity.MainActivity.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
public static void StartCreateAccount(Context context) {
    if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        context.startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT).putExtra(Settings.EXTRA_ACCOUNT_TYPES,
                new String[] { KusssAuthenticator.ACCOUNT_TYPE }));
    } else {/*from w  w  w .j a v a2 s . c om*/
        context.startActivity(new Intent(Settings.ACTION_ADD_ACCOUNT).putExtra(Settings.EXTRA_AUTHORITIES,
                new String[] { CalendarContractWrapper.AUTHORITY() }));
    }
}

From source file:com.btmura.android.reddit.app.MenuHelper.java

public static void startAddAccountActivity(Context context) {
    Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    intent.putExtra(Settings.EXTRA_AUTHORITIES, Array.of(AccountProvider.AUTHORITY));
    if (Build.VERSION.SDK_INT >= 18) {
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, Array.of(AccountUtils.getAccountType(context)));
    }//ww  w  .  j ava 2  s. c  o m
    context.startActivity(intent);
}

From source file:com.google.samples.apps.sergio.ui.BaseActivity.java

private void signInOrCreateAnAccount() {
    //Get list of accounts on device.
    AccountManager am = AccountManager.get(BaseActivity.this);
    Account[] accountArray = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
    if (accountArray.length == 0) {
        //Send the user to the "Add Account" page.
        Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] { "com.google" });
        startActivity(intent);//from  w  w w. j  a v  a2 s  .c o m
    } else {
        //Try to log the user in with the first account on the device.
        startLoginProcess();
        mDrawerLayout.closeDrawer(Gravity.START);
    }
}

From source file:xyz.template.material.menu.ui.BaseActivity.java

private void signInOrCreateAnAccount() {
    //Get list of accounts on device.
    AccountManager am = AccountManager.get(BaseActivity.this);
    Account[] accountArray = am.getAccountsByType("com.google");
    if (accountArray.length == 0) {
        //Send the user to the "Add Account" page.
        Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] { "com.google" });
        startActivity(intent);//from   ww  w  . j  av  a  2s. c o m
    } else {
        //Try to log the user in with the first account on the device.
        startLoginProcess();
        mDrawerLayout.closeDrawer(Gravity.START);
    }
}

From source file:com.google.samples.apps.iosched.ui.BaseActivity.java

private void signInOrCreateAnAccount() {
    //Get list of accounts on device.
    AccountManager am = AccountManager.get(BaseActivity.this);
    Account[] accountArray = am.getAccountsByType(GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE);
    if (accountArray.length == 0) {
        //Send the user to the "Add Account" page.
        Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] { GoogleAuthUtil.GOOGLE_ACCOUNT_TYPE });
        startActivity(intent);//  w  ww . j av  a 2 s  .c  o m
    } else {
        //Try to log the user in with the first account on the device.
        startLoginProcess();
        mDrawerLayout.closeDrawer(GravityCompat.START);
    }
}

From source file:com.google.samples.apps.iosched.ui.BaseActivity.java

private void promptAddAccount() {
    Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] { "com.google" });
    startActivity(intent);/*from   ww w . j  a va  2  s.c  o  m*/
    finish();
}