[英]Trusted Web Activity [TWA] - Can it read AccountManager accounts on Android?
AccountManager
API in Android via a TWA LauncerActivity
.问题:尝试通过 TWA LauncerActivity
在 Android 中读取通过AccountManager
API 创建的帐户。I have confirmed I have accounts on device, and am attempting a print out to Logcat of all of the accounts, but I am returned no results:我已确认我在设备上有帐户,并正在尝试将所有帐户打印到 Logcat,但没有返回任何结果:
private void printAccounts() {
Account[] accounts = AccountManager.get(this).getAccounts();
Log.d("FoundAccount", "Total accounts: " + accounts.length);
for (Account account : accounts) {
Log.d("FoundAccount", ": " + account.name);
}
}
Resulting output via Logcat:通过 Logcat 生成 output:
D/FoundAccount: Total accounts: 0
Any resources would be greatly appreciated, thank you!任何资源将不胜感激,谢谢!
After running the exact same code in a pre-existing Android application, the accounts were pulled right away for Google and custom third party accounts.在预先存在的 Android 应用程序中运行完全相同的代码后,立即为 Google 和自定义第三方帐户提取了这些帐户。 Safe to say this functionality doesn't exist for TWAs... if anyone else has any links to the documentation for this, I would say that is still pertinent information, but for the sake of answering this question for anyone else seeking an answer to the same question.... the answer is no, this functionality is not possible, at least at this time.可以肯定地说 TWA 不存在此功能......如果其他人有任何指向此文档的链接,我会说这仍然是相关信息,但为了回答这个问题以供其他寻求答案的人回答同样的问题......答案是否定的,这个功能是不可能的,至少目前是这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.