2013-07-11 40 views
1

解锁软件,我在应用程序的版本2的开发与应用,并发布在谷歌开发者现在有人下载的应用程序,并尝试购买。即使在此消息应用程序“解锁”之后,购买消息也会向他显示“您的卡片正在衰落”。现在,这是一个非常困难的情况,即在应用程序解锁时不支付款项。在我的应用程序或与Google的应用程序结算方式(逻辑)中,这是否存在问题。甚至付款后下降

如果它在我的应用程序,然后在那里它检查人卡是“谢绝牌”所以在这个方法我可以限制我的应用程序不会解锁应用程序的任何方法。

任何应用将受到赞赏。

我有这样的代码在我BillingReceviver:

@Override 
    public void onReceive(Context context, Intent intent) { 
     String action = intent.getAction(); 
     if (Consts.ACTION_PURCHASE_STATE_CHANGED.equals(action)) { 
      String signedData = intent.getStringExtra(Consts.INAPP_SIGNED_DATA); 
      String signature = intent.getStringExtra(Consts.INAPP_SIGNATURE); 
      purchaseStateChanged(context, signedData, signature); 
     } else if (Consts.ACTION_NOTIFY.equals(action)) { 
      String notifyId = intent.getStringExtra(Consts.NOTIFICATION_ID); 
      if (Consts.DEBUG) { 
       Log.i(TAG, "notifyId: " + notifyId); 
      } 
      notify(context, notifyId); 
     } else if (Consts.ACTION_RESPONSE_CODE.equals(action)) { 
      long requestId = intent.getLongExtra(Consts.INAPP_REQUEST_ID, -1); 
      int responseCodeIndex = intent.getIntExtra(Consts.INAPP_RESPONSE_CODE, 
        ResponseCode.RESULT_ERROR.ordinal()); 
      checkResponseCode(context, requestId, responseCodeIndex); 
     } else { 
      Log.w(TAG, "unexpected action: " + action); 
     } 
    } 

使得ACTION_PUR​​CHASE_STATE_CHANGED文件BillingService有我的purchsedstatechanged电话

private void purchaseStateChanged(int startId, String signedData, String signature) { 
     ArrayList<Security.VerifiedPurchase> purchases; 
     DatabaseHandler db=new DatabaseHandler(this); 
     purchases = Security.verifyPurchase(signedData, signature); 
     if (purchases == null) { 
      return; 
     } 

     ArrayList<String> notifyList = new ArrayList<String>(); 
     for (VerifiedPurchase vp : purchases) { 
      if (vp.notificationId != null) { 
       notifyList.add(vp.notificationId); 
      } 


      ResponseHandler.purchaseResponse(this, vp.purchaseState, vp.productId, 
        vp.orderId, vp.purchaseTime, vp.developerPayload); 



     db.addUser("com.example.app", "111", "1222"); 

     Log.i("Usgdgfer",""+db.isUserPresent("com.example.app")); 
     } 
     if (!notifyList.isEmpty()) { 
      String[] notifyIds = notifyList.toArray(new String[notifyList.size()]); 
      confirmNotifications(startId, notifyIds); 
     } 
    } 
+0

请,如果任何人知道这件事,然后提供一些信息 – User42590

+0

你能在回答这个问题阐述。我还是不明白。 – RobCroll

回答

0

通常情况下,该卡必须映射到谷歌的行动相匹配后购买前的电子钱包帐户。如果该卡无效,则在您将卡映射到您的Google帐户时将显示错误。

似乎很奇怪的是,卡在购买时被验证。即使如此,如果付款没有正确完成,您应该收到错误回复

BILLING_RESPONSE_RESULT_USER_CANCELED = 1; BILLING_RESPONSE_RESULT_BILLING_UNAVAILABLE = 3;

检查在IabResult中收到它们后是否正确处理这些错误。确保您只有在收到适当的回复后才能解锁您的应用。

+0

请参阅我的问题,我再次更新了它.. – User42590

+1

无论哪种方式,务必使基于响应代码的应用程序转换决定接受(错误,取消,OK等)。就实现而言,使用v3要容易得多。 –