【问题标题】:Setting up Google phone Account programmatically以编程方式设置 Google 手机帐户
【发布时间】:2012-09-22 20:21:05
【问题描述】:

我有兴趣在手机上以编程方式添加和设置具有给定用户名和密码的硬编码 Google 帐户,而无需任何用户干预。

我尝试过使用

AccountsManager.addAccountExplicitly(newAccount("xxxxxx@gmail.com","com.google",password,null) 

它适用于所有accountsType,除了 com.google accountsType 抛出“uid 不匹配身份验证器” id”异常。

我已经按照这个特定线程中给出的所有建议来修复错误但没有用,com.google 帐户类型的错误仍然存​​在

SecurityException: caller uid XXXX is different than the authenticator's uid

我尝试的另一种替代方法是使用samplesyncadapter 代码,它工作得很好,身份验证部分在NetworkUtilities 文件中完成,我认为需要将其更改为Google 帐户clientlogin

是否可以直接执行此操作而无需用户干预验证码?

【问题讨论】:

    标签: android accountmanager google-account


    【解决方案1】:

    几个月后,我设法解决了这个问题。可能对某人有帮助。

    解决方案不是通用的,而是针对模拟器/设备 LCD 特性和丑陋的。

    我使用 MonkeyRunner 在指定屏幕坐标处发出触摸、按下和按键事件,以到达 Home->Apps->Settings->Accounts and Sync->Add Account->Google->Next->Sign In 等等

    有关 MonkeyRunner 的更多详细信息,请参见此处

    http://developer.android.com/tools/help/monkeyrunner_concepts.html

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-03
      • 2016-09-20
      • 1970-01-01
      • 1970-01-01
      • 2010-11-17
      相关资源
      最近更新 更多