You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

技术求助:如何在Android中通过Intent打开Google Account Info界面

Hey there! I’ve dealt with this exact scenario before, so let me walk you through the reliable methods to launch the Google Account Info activity via Intent. Let’s dive in:

Method 1: Direct Intent to Google Play Services Account Settings

This is the most direct way to jump straight to the specific Google account info screen (assuming the target screen is part of Google Play Services, which it usually is). Here’s the code for both Kotlin and Java:

Kotlin

val accountIntent = Intent("com.google.android.gms.settings.ACCOUNT_SETTINGS")
// Optional: Pass the account email to open that specific account directly
accountIntent.putExtra("account_name", "user@example.com")
// Ensure we target Google Play Services to avoid ambiguity
accountIntent.setPackage("com.google.android.gms")

try {
    startActivity(accountIntent)
} catch (e: ActivityNotFoundException) {
    // Handle cases where Google Play Services is missing or unsupported
    Toast.makeText(this, "Failed to open account settings", Toast.LENGTH_SHORT).show()
}

Java

Intent accountIntent = new Intent("com.google.android.gms.settings.ACCOUNT_SETTINGS");
// Optional: Specify a specific account to open
accountIntent.putExtra("account_name", "user@example.com");
accountIntent.setPackage("com.google.android.gms");

try {
    startActivity(accountIntent);
} catch (ActivityNotFoundException e) {
    Toast.makeText(this, "Failed to open account settings", Toast.LENGTH_SHORT).show();
}

Key Notes:

  • The account_name extra is optional. Omit it, and the intent will open the main Google account list first, letting the user select which account to view.
  • Wrapping the call in a try-catch is critical—some rare devices might not have Google Play Services installed, which would throw an exception.
Method 2: Fallback to System Account Settings

If Method 1 doesn’t land you exactly on the screen in your screenshot (unlikely, but possible on some custom ROMs), use this fallback to open the system’s Google account settings:

Kotlin

val systemAccountIntent = Intent(Settings.ACTION_SYNC_SETTINGS)
systemAccountIntent.putExtra("account_type", "com.google")

try {
    startActivity(systemAccountIntent)
} catch (e: ActivityNotFoundException) {
    Toast.makeText(this, "Account settings not available", Toast.LENGTH_SHORT).show()
}

Java

Intent systemAccountIntent = new Intent(Settings.ACTION_SYNC_SETTINGS);
systemAccountIntent.putExtra("account_type", "com.google");

try {
    startActivity(systemAccountIntent);
} catch (ActivityNotFoundException e) {
    Toast.makeText(this, "Account settings not available", Toast.LENGTH_SHORT).show();
}

This will open the system’s sync settings page filtered to only Google accounts. From there, the user can tap their account to access the info screen you’re targeting.

If you can point out specific UI elements or labels from your screenshot, we can narrow down which method is the perfect match for your exact target screen.

内容的提问来源于stack exchange,提问作者Amol Chandra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 12:57:30