繁体   English   中英

Google Play说要登录Google帐户(应用内结算)

[英]Google Play says to sign into Google account (In-app billing)

我已经尝试解决这个问题了一个星期,但没有任何成功。 事实是,如果该应用程序的用户尝试购买订阅但未登录Google帐户并导致他进入Google登录屏幕,但即使在用户登录并尝试购买订阅后,我仍会处理,Google Play表示他需要登录Google帐户。 在这一步中,我一直在调试,并且AccountManager的getAccounts()返回包含用户最近添加的帐户的数组。 而且只有在我终止该应用程序并再次启动它之后,Google Play才会看到用户的Google帐户和购买正常。 任何想法如何解决此问题? 这是用户单击“购买”按钮时调用的方法:

accountsArray = accountManager.getAccountsByType("com.google");
   if(accountsArray != null && accountsArray.length >= 1){
       SystemUtils.getCache(this, new CacheUtils.CallBack<Cache>() {
           @Override
           public void run(Cache cache) {
               billingActivityCache = cache;
           }
       });

       JSONObject payload = null;
       try {
           payload = new JSONObject()
                   .put("user", new JSONObject()
                           .put("id", billingActivityCache.getUser().getId()
                           ));
       } catch (JSONException e) {
           e.printStackTrace();
       }

       Bundle buyIntentBundle = null;
       try {
           buyIntentBundle = mService.getBuyIntent(3, getPackageName(),
                   currentSku, "subs", payload.toString());
       } catch (RemoteException e) {
           e.printStackTrace();
       }

       PendingIntent pendingIntent = buyIntentBundle.getParcelable("BUY_INTENT");
       try {
           startIntentSenderForResult(pendingIntent.getIntentSender(),
                   BUY_KEY, new Intent(), Integer.valueOf(0), Integer.valueOf(0),
                   Integer.valueOf(0));
       } catch (IntentSender.SendIntentException e) {
           e.printStackTrace();
       }
   } else{
       Intent intent = new Intent(Settings.ACTION_ADD_ACCOUNT);
       intent.putExtra(Settings.EXTRA_ACCOUNT_TYPES, new String[]{"com.google"});
       startActivityForResult(intent, LOGIN_GOOGLE);
   }

(不是答案的一部分,但是)
首先,请勿将个人信息作为捆绑放在平面文字中。
用户ID是个人信息。
查看Google隐私权政策。


相关问答。 [更改Gmail帐户以进行应用内购买?] https://android.stackexchange.com/questions/70215/change-gmail-account-to-make-in-app-purchase

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM