【问题标题】:Running Accounts & sync settings运行帐户和同步设置
【发布时间】:2011-07-12 16:45:28
【问题描述】:

我目前正在使用 Android 的 AccountManager 类检索用户的 gmail 用户名。 我的问题是我的应用程序假定用户已经将他的 Google 帐户添加到他的 Android 手机,我想问是否可以启动帐户和同步设置应用程序以防用户实际上没有绑定他的 Google 帐户到他的手机?

 AccountManager accountManager = AccountManager.get(getApplicationContext());
 Account[] accounts = accountManager.getAccountsByType("com.google");
 if (accounts.length == 0) // How?
    // run Accounts & sync settings so that the user can add his Google account

【问题讨论】:

    标签: android


    【解决方案1】:
    Intent intent = new Intent(Settings.ACTION_SYNC_SETTINGS);
    startActivity(intent);
    

    http://developer.android.com/reference/android/provider/Settings.html#ACTION_SYNC_SETTINGS

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-05-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多