Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 应用程序能否识别用户创建了google帐户?_Android_Events_Android Intent - Fatal编程技术网

Android 应用程序能否识别用户创建了google帐户?

Android 应用程序能否识别用户创建了google帐户?,android,events,android-intent,Android,Events,Android Intent,可能重复: 嗨,有没有办法知道用户在我的应用程序中创建了新的谷歌帐户? 通过意图、事件或任何其他方式 谢谢 使用getAccountsByType(字符串)或 getAccountsByTypeAndFeatures(字符串,字符串[],AccountManagerCallback, 处理程序)。通常,应用程序只对帐户感兴趣 具有一个特定类型,用于标识身份验证器。账户 功能用于识别特定的帐户子类型和 能力。帐户类型和功能都是 验证器特定的字符串,并且应用程序必须知道 与首选身份验证器协调 这将

可能重复:

嗨,有没有办法知道用户在我的应用程序中创建了新的谷歌帐户? 通过意图、事件或任何其他方式

谢谢

使用
getAccountsByType(字符串)
getAccountsByTypeAndFeatures(字符串,字符串[],AccountManagerCallback,
处理程序)
。通常,应用程序只对帐户感兴趣 具有一个特定类型,用于标识身份验证器。账户 功能用于识别特定的帐户子类型和 能力。帐户类型和功能都是 验证器特定的字符串,并且应用程序必须知道 与首选身份验证器协调

这将创建一个谷歌帐户,如果还没有

AccountManager accountMgr = AccountManager.get(mContext);
accountMgr.addAccount("com.google", "ah", null, new Bundle(), (Activity) mContext, null, null);

“ah”是授权令牌类型。

作者想知道帐户是否已经存在,而不是创建新帐户。
AccountManager accountMgr = AccountManager.get(mContext);
accountMgr.addAccount("com.google", "ah", null, new Bundle(), (Activity) mContext, null, null);