Android 市场应用内结算 IN_APP_NOTIFY 响应

发布于 2024-11-29 20:33:51 字数 704 浏览 5 评论 0原文

我正在尝试了解 Android 的应用内计费文档,特别是 IN_APP_NOTIFIY 响应。查看参考,内容如下

com.android.vending.billing.IN_APP_NOTIFY

此响应表示购买已更改状态,这意味着购买成功、已取消或已退款。 此响应包含一个或多个通知 ID。每个通知ID对应一条特定的服务器端消息,每条消息包含有关一个或多个事务的信息。您的应用程序收到 IN_APP_NOTIFY 广播意图后,您可以发送带有通知 ID 的 GET_PURCHASE_INFORMATION 请求以检索消息详细信息。示例应用程序将此广播意图分配给名为 ACTION_NOTIFY 的常量。

额外内容

notification_id - 代表给定购买状态更改的通知 ID 的字符串。当购买状态发生变化时,Android Market 会通知您,并且该通知包含唯一的通知 ID。要获取购买状态更改的详细信息,您可以通过 GET_PURCHASE_INFORMATION 请求发送通知 ID。

当响应只是一个字符串时,如何获取多个通知 ID?如何处理多个通知的情况?

I'm trying to understand the In-App Billing documentation for Android, specifically the IN_APP_NOTIFIY response. Looking at the reference, it reads as followings

com.android.vending.billing.IN_APP_NOTIFY

This response indicates that a purchase has changed state, which means a purchase succeeded, was canceled, or was refunded. This response contains one or more notification IDs. Each notification ID corresponds to a specific server-side message, and each messages contains information about one or more transactions. After your application receives an IN_APP_NOTIFY broadcast intent, you send a GET_PURCHASE_INFORMATION request with the notification IDs to retrieve the message details. The sample application assigns this broadcast intent to a constant named ACTION_NOTIFY.

Extras

notification_id—a String representing the notification ID for a given purchase state change. Android Market notifies you when there is a purchase state change and the notification includes a unique notification ID. To get the details of the purchase state change, you send the notification ID with the GET_PURCHASE_INFORMATION request.

How do I get multiple notification IDs when the response is only a string? How do I take care of the multiple notifications case?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

四叶草在未来唯美盛开 2024-12-06 20:33:51

看来google文档确实是错误的。也许编写摘录的人对“即使您的应用程序已发送 CONFIRM_NOTIFICATIONS 消息,Google Play 也可能会重复发送 PURCHASE_STATE_CHANGED 消息的 IN_APP_NOTIFY 意图”这一事实感到困惑。可以在此处阅读:http://developer .android.com/guide/google/play/billing/billing_overview.html#billing-action-notify

这意味着您应该能够处理多个 IN_APP_NOTIFY 意图,但只有一个IN_APP_NOTIFY 意图仅包含一个通知 ID。另一种可能性是,编写文档的人对以下事实感到困惑:在发出 GET_PURCHASE_INFORMATION 类型的请求时,您可以发送一组通知 ID,如“检索购买或退款的交易信息 (GET_PURCHASE_INFORMATION)”部分中所公开的那样在文档中:http://developer.android.com/guide/google/play/billing/billing_integrate.html

It seems that the google documentation is indeed wrong. Maybe the guy who wrote the excerpt got confused with the fact that "Google Play may send repeated IN_APP_NOTIFY intents for a PURCHASE_STATE_CHANGED message even though your application has sent a CONFIRM_NOTIFICATIONS message." as can be read here: http://developer.android.com/guide/google/play/billing/billing_overview.html#billing-action-notify

That means that you should be able to handle multiple IN_APP_NOTIFY intents, but one IN_APP_NOTIFY intents contains only one notification ID. Another possibility is that the guy who wrote the documentation got confused with the fact that you can send an array of notification IDs when making a request of the type GET_PURCHASE_INFORMATION as exposed in the section "Retrieving transaction information for a purchase or refund (GET_PURCHASE_INFORMATION)" in the doc: http://developer.android.com/guide/google/play/billing/billing_integrate.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文