应用内结算不适用于 G1
我已经在我的 Android 应用程序中实现了应用内计费。它在我自己的 Android 版本 2.2 和 Market 版本 2.3.4 的设备上运行良好。但它不适用于测试带有 Android 1.6 和市场版本 1002211 的设备 T-Mobile G1(奇怪的版本..但它具有应用内计费权限)。抛出异常:
ERROR/Bundle(2079): readBundle: bad magic number
ERROR/Bundle(2079): readBundle: trace = java.lang.RuntimeException
at android.os.Bundle.readFromParcelInner(Bundle.java:1473)
at android.os.Bundle.<init>(Bundle.java:82)
at android.os.Parcel.readBundle(Parcel.java:1344)
at android.os.Parcel.readBundle(Parcel.java:1329)
at android.os.Bundle$1.createFromParcel(Bundle.java:1410)
at android.os.Bundle$1.createFromParcel(Bundle.java:1413)
at com.android.vending.billing.IMarketBillingService$Stub$Proxy.sendBillingRequest(IMarketBillingService.java:102)
at MyAppPackages.BillingService$RestoreTransactions.run(BillingService.java:310)
at MyAppPackages.BillingService$BillingRequest.runIfConnected(BillingService.java:118)
at MyAppPackages.BillingService$BillingRequest.runRequest(BillingService.java:97)
at MyAppPackages.BillingService.restoreTransactions(BillingService.java:428)
at MyAppPackages.BillingActivity.restoreDatabase(BillingActivity.java:193)
at MyAppPackages.BillingActivity.access$000(BillingActivity.java:45)
at MyAppPackages.BillingActivity$PurchaseObserver.onBillingSupported(BillingActivity.java:107)
at MyAppPackages.ResponseHandler.checkBillingSupportedResponse(ResponseHandler.java:83)
at MyAppPackages.BillingService$CheckBillingSupported.run(BillingService.java:188)
at MyAppPackages.BillingService$BillingRequest.runIfConnected(BillingService.java:118)
at MyAppPackages.BillingService.runPendingRequests(BillingService.java:521)
at MyAppPackages.BillingService.onServiceConnected(BillingService.java:554)
at android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThread.java:1053)
at android.app.ActivityThread$PackageInfo$ServiceDispatcher$RunConnection.run(ActivityThread.java:1070)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
请帮助我了解发生了什么。
I've imlemented in-app billing in my Android application. It works fine on my own device with Android version 2.2 and Market version 2.3.4. But it is not working on testing device T-Mobile G1 with Android 1.6 and Market version 1002211 (strange version..but it has in-app billing permission). An exception is thrown:
ERROR/Bundle(2079): readBundle: bad magic number
ERROR/Bundle(2079): readBundle: trace = java.lang.RuntimeException
at android.os.Bundle.readFromParcelInner(Bundle.java:1473)
at android.os.Bundle.<init>(Bundle.java:82)
at android.os.Parcel.readBundle(Parcel.java:1344)
at android.os.Parcel.readBundle(Parcel.java:1329)
at android.os.Bundle$1.createFromParcel(Bundle.java:1410)
at android.os.Bundle$1.createFromParcel(Bundle.java:1413)
at com.android.vending.billing.IMarketBillingService$Stub$Proxy.sendBillingRequest(IMarketBillingService.java:102)
at MyAppPackages.BillingService$RestoreTransactions.run(BillingService.java:310)
at MyAppPackages.BillingService$BillingRequest.runIfConnected(BillingService.java:118)
at MyAppPackages.BillingService$BillingRequest.runRequest(BillingService.java:97)
at MyAppPackages.BillingService.restoreTransactions(BillingService.java:428)
at MyAppPackages.BillingActivity.restoreDatabase(BillingActivity.java:193)
at MyAppPackages.BillingActivity.access$000(BillingActivity.java:45)
at MyAppPackages.BillingActivity$PurchaseObserver.onBillingSupported(BillingActivity.java:107)
at MyAppPackages.ResponseHandler.checkBillingSupportedResponse(ResponseHandler.java:83)
at MyAppPackages.BillingService$CheckBillingSupported.run(BillingService.java:188)
at MyAppPackages.BillingService$BillingRequest.runIfConnected(BillingService.java:118)
at MyAppPackages.BillingService.runPendingRequests(BillingService.java:521)
at MyAppPackages.BillingService.onServiceConnected(BillingService.java:554)
at android.app.ActivityThread$PackageInfo$ServiceDispatcher.doConnected(ActivityThread.java:1053)
at android.app.ActivityThread$PackageInfo$ServiceDispatcher$RunConnection.run(ActivityThread.java:1070)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4203)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
at dalvik.system.NativeStart.main(Native Method)
Please help me to understand what's happening.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在过时的市场上的 LG P500 上遇到了同样的问题......
问题出在 Billing-Service 的 CheckBillingSupported 子类的 run() 方法上。
尽管市场不支持计费,它将返回“true”...
响应代码将产生 0,因为额外字段 BILLING_RESPONSE_RESPONSE_CODE 并未实际设置 - 而是默认返回 0;顺便说一下,RESULT_OK 也是 0。
要解决此问题,请将调用替换为:
这解决了我的问题。
I ran into the same issue on my LG P500 with an outdated market...
The problem is the run() method of the CheckBillingSupported sub class of the Billing-Service.
It will return "true" although the market does not support Billing ...
The response code will yield 0 since the extra field BILLING_RESPONSE_RESPONSE_CODE is not actually set - but instead defaults back to 0; Incidentally RESULT_OK is also 0.
To fix this replace the call with:
This fixed my issue.