在&QUOT的目的是什么;开发有效负荷QUOT;?可以说,它是用来做什么? [英] What is the purpose of the "developer payload"? What can it be used for?

查看:119
本文介绍了在&QUOT的目的是什么;开发有效负荷QUOT;?可以说,它是用来做什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Android的文档说,它意味着有关订单的补充信息,但同时也表示,不能用这个来发送实际数据或内容。

The Android docs say that its meant for "supplemental information about an order" but at the same time it also says not to use this to send "actual data or content".

那么,什么是这个开发商有效载荷的目的是什么?为什么这个功能存在吗?你能描述的如何,我可以在我自己的应用内计费的实现使用一个现实世界的实际例子?

So what is the purpose of this "developer payload"? Why does this feature exist? Can you describe a real-world practical example of how I can use it in my own In-app Billing implementation?

推荐答案

由于aromero提到的开发商有效载荷字段的大小限制。这就是为什么文档建议不要使用此键发送数据或内容。

As aromero mentioned the developer payload field is limited in size. This is why the docs recommend not to use this key to send data or content.

你要做的反而是将内容保存到数据库的地方(例如,用户的设备或您自己的服务器上),然后把记录的指数在开发者有效载荷字段。当你通过 PURCHASE_STATE_CHANGED 广播意图接收回来,你可以在你的数据库中的数据相关联。

What you do instead is save the content to a database somewhere (e.g. on the user's device or your own server), and then put the record's index in the developer payload field. When you receive it back via the PURCHASE_STATE_CHANGED broadcast intent, you can associate it with the data in your database.

请注意,开发商有效载荷的不可以在使用任何标准的Andr​​oid项目IDS由市场派。您必须使用真实的应用程序内购买的物品。

Note that the developer payload is not sent by the Market when using any of the test android item ids. You have to be using real in app purchase items.

此外,根据这个(我没有验证这还),你将不会被接受developerPayload在调试模式。您需要登录您的应用程序释放模式接收developerPayload。

Also, according to this (I have not verified this yet), you will not be receiving the developerPayload in DEBUG MODE. You need to sign your application to RELEASE MODE to receive developerPayload.

最后,正如您在下面评论说,返回的的JSONObject (响应GetPurchaseInformation)已经包含的orderId ID,产品,purchaseTime等等。因此,开发商的有效载荷实际上应该被用于任何但是标识购买...即答案是什么已经提出下面的对面。你可以使用开发商的有效载荷是为添加未在的JSONObject ,像购买者的其它详细信息(如GPS定位的一些信息,如果启用,设备品牌和放大器;模型等)

Lastly, as you commented below, the returned JSONObject (in response to GetPurchaseInformation) already includes orderId, productId, purchaseTime and more. So "developer payload" should actually be used for anything but to identify the purchase... i.e. the answer is the opposite of what has been suggested below. What you can use "developer payload" is to add some information not in the JSONObject, like purchaser's additional details (e.g. GPS location if enabled, device brand & model, etc.).

这篇关于在&QUOT的目的是什么;开发有效负荷QUOT;?可以说,它是用来做什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆