如何使用Intent打开Gmail登录活动

时间:2020-01-31 06:54:45

标签: android android-intent gmail

我想直接使用 Intent 从另一个应用程序打开 Gmail登录活动。我可以使用其程序包名称 com.google.android.gm 打开 gmail应用程序。但是我想知道如何直接打开其“登录活动”,如下所示。

enter image description here enter image description here

  1. 这些活动的URI是什么? 或
  2. 如何获取这些URI?

1 个答案:

答案 0 :(得分:1)

您在此处提供的屏幕截图不是Gmail活动的一部分,而是Android操作系统本身的一部分,称为AccountManager

选中here可以了解更多信息

现在是主要答案:-

正如您指定要通过意图启动它们一样,您可以执行

//pass the action while creating intent
Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);

//setting type for Google Accounts
intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[] {"com.google"});

startActivity(intent);