简体   繁体   English

受信任的 Web 活动 [TWA] - 它可以读取 Android 上的 AccountManager 帐户吗?

[英]Trusted Web Activity [TWA] - Can it read AccountManager accounts on Android?

Problem: Attempting to read accounts created via AccountManager API in Android via a TWA LauncerActivity .问题:尝试通过 TWA LauncerActivity在 Android 中读取通过AccountManager API 创建的帐户。

  • I'm aware that some native functionality isn't possible in Android, and if I am attempting something that is impossible please link me a resource.我知道某些本机功能在 Android 中是不可能的,如果我正在尝试一些不可能的事情,请链接我一个资源。 I haven't came across anything explicitly about account manager access.我没有遇到任何关于客户经理访问的明确信息。

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.

相关问题 Android native 和 Trusted Web Activity (TWA) 之间的通信 - Communication between Android native and Trusted Web Activity(TWA) 是否有使用AccountManager帐户在Android上对Google Data API进行身份验证的官方方法? - Is there an official way to authenticate for Google Data API on Android using AccountManager accounts? 如何使AccountManager每个用户名处理多个帐户? - How can I make AccountManager handle multiple accounts per username? 从受信任的 Z2567A5EC9705EB7AC2C984033DZ06 活动调用 android shell 应用程序本机 function - Calling android shell app native function from trusted web activity(PWA) com.google.gdata.client.GoogleService.setUserToken(android.accounts.AccountManager.getAuthToken(???)) - com.google.gdata.client.GoogleService.setUserToken(android.accounts.AccountManager.getAuthToken(???)) 如何在具有Google帐户的Android中使用AccountManager? - How can I use AccountManager in Android with Google Account? Android、AccountManager 和 OAuth - Android, AccountManager and OAuth 受信任的Web活动无法启动活动ComponentInfo Service Intent必须明确:Intent - Trusted web activity Unable to start activity ComponentInfo Service Intent must be explicit: Intent Android on NFC读取关闭活动(不是主要活动) - Android on NFC read close activity (not the main activity) Android AccountManager.getUserData() 返回 null - Android AccountManager.getUserData() returns null
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM