- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
永远不会调用回调方法 onPurchaseStateChange
。我做了自己的演示应用程序,还尝试使用谷歌提供的演示(地下城)。
我从 onClick
方法调用 requestPurchase(String productId, String payload)
。
@Override
public void onClick(View view) {
if(view == requestPurchaseButton) {
mBillingService.requestPurchase("android.test.purchased", "10");
}
}
调用回调方法onRequestPurchaseResponse(Request, ResponseCode)
。此处的 responseCode
给出了值 RESULT_OK
。所以请求已经发送到服务器。
@Override
public void onRequestPurchaseResponse(RequestPurchase request,
ResponseCode responseCode)
{
if(responseCode == ResponseCode.RESULT_OK) {
Log.d("AJ", "onRequestPurchaseResponse.ResponeCode.RESULT_OK");
textView.append(request.mProductId + "\n");
} else if(responseCode == ResponseCode.RESULT_USER_CANCELED) {
//doesn't go here
} else {
//doesn't go here
}
}
此方法的 javadoc 说明
This is called when we receive a response code from Market for a RequestPurchase request that we made. This is NOT used for any purchase state changes. All purchase state changes are received in onPurchaseStateChange(PurchaseState, String, int, long). This is used for reporting various errors, or if the user backed out and didn't purchase the item. The possible response codes are: RESULT_OK means that the order was sent successfully to the server. The onPurchaseStateChange() will be invoked later (with a purchase state of PURCHASED or CANCELED) when the order is charged or canceled. This response code can also happen if an order for a Market-managed item was already sent to the server. RESULT_USER_CANCELED means that the user didn't buy the item. RESULT_SERVICE_UNAVAILABLE means that we couldn't connect to the Android Market server (for example if the data connection is down). RESULT_BILLING_UNAVAILABLE means that in-app billing is not supported yet. RESULT_ITEM_UNAVAILABLE means that the item this app offered for sale does not exist (or is not published) in the server-side catalog. RESULT_ERROR is used for any other errors (such as a server error).
但是回调方法
@Override
public void onPurchaseStateChange(PurchaseState purchaseState,
String itemId, int quantity, long purchaseTime,
String developerPayload) {
Log.d("AJ", "onPurchaseStateChanged");
}
永远不会被调用。
我错过了什么吗?在 Dungeons 中正在做同样的事情(Google 提供的演示)并且 onPurchaseStateChange
没有被调用。
Test-InAppBilling文件显示我们必须能够达到 Purchased 状态。但是当我尝试时,我只看到
android.test.purchased: sending purchase request.
最佳答案
我遇到了同样的问题,但我自己解决了。我在代码中使用我工作的公钥,但试图在我的个人手机上运行该应用程序。由于我是使用个人帐户在手机上登录的,所以我猜谷歌正确地认为我不是开发者。我认为他们会发回一条错误消息。将我的个人 key 插入代码后,它在我的手机上运行良好。因此 key 可能也不适合您。
关于android - 永远不会调用 Google InAppBilling onPurchaseStateChange,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5429345/
我正在使用 Cordova 和这个插件,我目前正在 Google Play 上测试应用内购买。 这是插件地址: LINK HERE 当我使用时效果很好: function buy(){ //
我在 PlayStore 上确实有一个应用程序,但当前版本存在一个主要问题。每天我都会收到很多客户的邮件,说他们为 InAppItem 付款,但没有收到。 有两种表现形式: 客户收到来自 google
我在本地设置了“Dungeons”InAppBilling 示例,我准备尝试一下,但我有点困惑。我有一个这样的按钮: Button donate = (Button)findViewById(R.id
首先请原谅我的无知。尽管我找不到,但这个问题可能有一个非常明确的答案。别以为我没找过。实际上,我查看了网络,并试图在 StackOverFlow 上的 InAppPurchase 主题下找到答案。然而
我正在尝试将一些应用内购买添加到我正在开发的应用中,但进展并不顺利。 我有一个像这样的 FragmentActivity: public class TestInAppBilling extends
我正在使用 android InAppBilling 购买我的应用程序中的产品。我正在关注 https://developer.android.com/google/play/billing/bill
我在我的应用中设置了一个订阅产品,它可以用于购买。我在谷歌开发者控制台中看到了购买。当我注销然后重新登录应用程序时,我会再次进入订阅页面。该应用程序无法识别订阅已购买,它应该允许用户访问。如果我再次单
01-23 05:32:26.747: E/AndroidRuntime(14589): java.lang.NullPointerException 01-23 05:32:26.747: E/An
永远不会调用回调方法 onPurchaseStateChange。我做了自己的演示应用程序,还尝试使用谷歌提供的演示(地下城)。 我从 onClick 方法调用 requestPurchase(Str
我在集成谷歌的应用内结算时遇到了很多麻烦。 我有一个应该进行应用内结算的 Activity 。我使用 startActivity 方法从我的主要 Activity 中调用此 Activity 。 In
我正在尝试制作一个 inappbilling 演示。我跟着这个tutorial为了研究这个。 让我说说我完成这个任务所遵循的步骤 我使用了下面提到的代码 package com.ohn.inappbi
我使用 InAppBilling-V3 成功实现了 In App Billing图书馆。 我已经在我的 ProActivity 中实现了所有应用内结算, 成功完成购买后,我将共享首选项中的 bool
我一直在开发一个具有非常基本的 InAppBilling 需求的应用程序(用户可以购买该应用程序的 1 次升级)。我在测试期间遇到了一个让我感到困惑的问题。 在使用 android.test.purc
我正在我的 Android 应用中实现应用内结算。一切正常,但是,我正在尝试将广播接收器从 Activity 中解耦到 list 中。特别是在 Android 的 trivialdrive 示例中有这
我正在尝试通过使用 plugin InAppBilling 为 Xamarin 表单解决方案实现(应用内计费) 除了this one,我找不到这个插件的任何完整代码示例或文档。 我一步一步地按照说明操
根据开发者网站上的文档,我最近在我的应用程序中实现了 InAppBilling v3。我使用了 TRIVIAL DRIVE 示例中提供的 utils 包中的类。 我面临的问题是,如果用户已经在另一台设
我有以下方法(第一次工作正常): public void TipUs(){ String sku="tip_us"; try { Bundle buyIntentBundle
我花了一周时间寻找在 Android InAppBilling 上升级/降级订阅的解决方案。 关于这个函数有一个引用页面:http://developer.android.com/google/pla
我已经创建了 inallbilling 示例代码。出于测试目的,我已经通过了 SKU="android.test.purchases"但现在我想在 google play 商店上发布我的应用程序所以我
我在我的项目中实现了应用内结算,但有时它会给出以下 NullPointerException IabHelper.launchPurchaseFlow() 方法。目前我正在使用保留 ID 进行测试并且
我是一名优秀的程序员,十分优秀!