当前位置: 首页>>代码示例>>Java>>正文


Java Settings.ACTION_ADD_ACCOUNT属性代码示例

本文整理汇总了Java中android.provider.Settings.ACTION_ADD_ACCOUNT属性的典型用法代码示例。如果您正苦于以下问题:Java Settings.ACTION_ADD_ACCOUNT属性的具体用法?Java Settings.ACTION_ADD_ACCOUNT怎么用?Java Settings.ACTION_ADD_ACCOUNT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.provider.Settings的用法示例。


在下文中一共展示了Settings.ACTION_ADD_ACCOUNT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAddAccountClicked

public void onAddAccountClicked(View view) {
    Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{getString(R.string.account_type)});
    }
    startActivity(intent);
}
 
开发者ID:danvratil,项目名称:FBEventSync,代码行数:7,代码来源:MainActivity.java

示例2: openAndroidAccountCreationScreen

/**
 * Opens the Android account manager for adding or creating a Google account.
 * @param applicationContext
 */
private static void openAndroidAccountCreationScreen(
        Context applicationContext) {
    logEvent(ProfileAccountManagementMetrics.DIRECT_ADD_ACCOUNT, GAIA_SERVICE_TYPE_SIGNUP);

    Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    createAccountIntent.putExtra(
            EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
    createAccountIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT
            | Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK
            | Intent.FLAG_ACTIVITY_CLEAR_TOP);

    applicationContext.startActivity(createAccountIntent);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:17,代码来源:AccountManagementScreenHelper.java

示例3: createAddGoogleAccountIntent

private static Intent createAddGoogleAccountIntent() {
    Intent createAccountIntent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    // NOTE: the documentation says Settings.EXTRA_AUTHORITIES should be used,
    // but it doesn't work.
    createAccountIntent.putExtra(
            EXTRA_ACCOUNT_TYPES, new String[]{EXTRA_VALUE_GOOGLE_ACCOUNTS});
    return createAccountIntent;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:8,代码来源:AccountAdder.java

示例4: promptAddAccount

private void promptAddAccount() {
    Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
    intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{"com.google"});
    startActivity(intent);
    finish();
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:6,代码来源:BaseActivity.java

示例5: signInOrCreateAnAccount

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);
    } else {
        //Try to log the user in with the first account on the device.
        startLoginProcess();
        mDrawerLayout.closeDrawer(GravityCompat.START);
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:16,代码来源:BaseActivity.java


注:本文中的android.provider.Settings.ACTION_ADD_ACCOUNT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。