Android 应用内计费:对应用程序进行采样并将数据存储在数据库中
谁能解释一下为什么Android只在Android 应用内计费:对应用程序进行采样并将数据存储在数据库中,android,in-app-purchase,google-play,Android,In App Purchase,Google Play,谁能解释一下为什么Android只在onRestoreTransactionsResponse中存储数据,而不在onRequestPurchaseResponse中存储数据 既然这样做了,我不知道如何测试我的应用程序-如果我使用(android.test.purchased),那么就永远不会调用onRestoreTransactionsResponse。 如果我使用自己的产品id,我会得到一个错误,即不允许购买(我的应用程序上载到Android Market,但未发布;产品id已发布) (我的应
onRestoreTransactionsResponse
中存储数据,而不在onRequestPurchaseResponse
中存储数据
既然这样做了,我不知道如何测试我的应用程序-如果我使用(android.test.purchased),那么就永远不会调用onRestoreTransactionsResponse
。
如果我使用自己的产品id,我会得到一个错误,即不允许购买(我的应用程序上载到Android Market,但未发布;产品id已发布)
(我的应用程序只支持一种产品—“付费版应用程序”,可能我应该使用一些不同于示例应用程序的方法?要知道一件事,要能够测试您自己的项目,您必须创建一个已签名的应用程序apk,并在您的设备上手动安装它(这样对我很有效,否则我就犯了和你一样的错误)
我希望它能有所帮助!示例应用程序附带的PurchaseObserver文件中提供了解释- onRequestPurchaseResponse:
/**
* 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
* {@link #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).
onRestoreTransactionsResponse只是对我们请求的响应(而不是购买状态):
如果我在RestoreTransactionsResponse上调用,那么也会调用onRequestPurchaseResponse。谢谢。但是我可以调试这样的应用程序吗?
/**
* This is called when we receive a response code from Android Market for a
* RestoreTransactions request that we made. A response code of
* RESULT_OK means that the request was successfully sent to the server.
*/