我正在尝试实施应用内计费。我登录了一个在 Market 注册的测试帐户,并且我在代码中更新了我的公钥。我可以购买其中一个测试产品 ID。
但是,似乎在 PURCHASE_STATE_CHANGED 意图中发送了一个空白签名。日志显示如下:
INFO/BillingReceiver(21437): notifyId: android.test.purchased
WARN/ActivityManager(2513): Duplicate finish request for HistoryRecord{47de4b38 com.android.vending/.billing.InAppBuyPageActivity}
INFO/BillingService(21437): handleCommand() action: com.app.GET_PURCHASE_INFORMATION
DEBUG/BillingService(21437): GetPurchaseInformation
ERROR/BillingService(21437): getPurchaseInformation received RESULT_OK
DEBUG/BillingService(21437): request id: 4241021538346688898
INFO/BillingService(21437): handleCommand() action: com.android.vending.billing.RESPONSE_CODE
DEBUG/BillingService(21437): RequestPurchase: RESULT_OK
INFO/BillingService(21437): handleCommand() action: com.android.vending.billing.PURCHASE_STATE_CHANGED
INFO/Security(21437): signedData: {"nonce":-3927284292945900504,"orders":[{"notificationId":"android.test.purchased","orderId":"transactionId.android.test.purchased","packageName":"com.app","productId":"android.test.purchased","purchaseTime":1301944310410,"purchaseState":0}]}
INFO/Security(21542): signature:
INFO/Security(21437): Purchase not verified
INFO/Security(21437): Purchase count = 0
INFO/BillingService(21437): handleCommand() action: com.android.vending.billing.RESPONSE_CODE
DEBUG/BillingService(21437): GetPurchaseInformation: RESULT_OK
“购买未验证”是由于代码跳过了签名验证(因为它是空白的)并丢弃了该产品购买。
任何想法?我在文档中没有看到签名可能为空白或原因是什么。
FWIW,这只发生在我的 Samsung Vibrant Galaxy S (2.2.1) 上。它在 Droid (2.2.2) 上运行良好。
编辑:当我得到 PURCHASE_STATE_CHANGED Intent 作为恢复事务操作的结果时,我在日志中得到了这个:
INFO/BillingService(24010): handleCommand() action: com.android.vending.billing.PURCHASE_STATE_CHANGED
ERROR/Security(24010): data is null
这表明根本没有发送签名的有效载荷。
编辑:在进一步的测试中,当上传的应用程序和安装的应用程序的版本不同时,似乎会发生这种情况。http://code.google.com/p/marketbilling/issues/detail?id=15