相关疑难解决方法(0)

android应用内结算 - restoreTransactionInformation

我正在尝试使用应用内结算功能将免费应用升级为"付费"版本.我使用本教程中的代码来处理计费,因为官方开发人员网站上的代码过于复杂和混乱,无法跟随像我这样的简单流程.

我的代码升级工作正常.

当我尝试添加一些东西来检查用户是否已经购买但是通过重新安装或清除数据(我不关心哪些)而丢失了他们的购买数据时,问题出现了.

在应用启动时,我会检查第一次运行后设置的标志.如果该标志不存在,则会向用户显示一个对话框,警告他们应用程序将检查以前的购买情况,当他们单击"确定"时,将调用restoreTransactionInformation方法.然后这会导致应用程序强制关闭.

因为在调试时或在模拟器上应用程序内计费不起作用,所以每次我想尝试代码时都必须发布应用程序的签名版本.当我尝试进行restoreTransactionInformation请求时,我无法知道应用程序退出的原因.有没有人知道我如何诊断它,或者什么可能导致我的应用程序死亡?或者一个如何使用restoreTransactionInformation方法的工作示例?

编辑:所以看起来RESTORE_TRANSACTIONS请求得到正确的响应,并返回我的测试购买的详细信息.不幸的是,它可以用它做任何事情,应用程序被强制关闭.这是在市场响应RESTORE_TRANSACTIONS请求后发生的事情的logcat(没有混淆代码):

I/BillingService( 6484): confirmTransaction()
D/Finsky  ( 1884): [7] MarketBillingService.getPreferredAccount: com.hippypkg: Account from first account.
I/BillingService( 6484): current request is:**********
I/BillingService( 6484): RESTORE_TRANSACTIONS Sync Response code: RESULT_OK
D/WindowManagerImpl( 6484): finishRemoveViewLocked, mViews[0]: com.android.internal.policy.impl.PhoneWindow$DecorView@**********
W/InputManagerService( 1381): [unbindCurrentClientLocked] Disable input method client.
W/InputManagerService( 1381): [startInputLocked] Enable input method client.
D/NativeCrypto( 1884): returned from sslSelect() with result 1, error code 2
D/Finsky  ( 1884): [1] MarketBillingService.sendResponseCode: Sending response RESULT_OK for request ********** to com.hippypkg.
I/BillingService( 6484): Received action: …
Run Code Online (Sandbox Code Playgroud)

android in-app-billing

7
推荐指数
1
解决办法
3748
查看次数

标签 统计

android ×1

in-app-billing ×1