Android 应用内结算网络访问
我想知道应用内计费 api 在检查用户是否购买了商品时是否需要访问互联网。
我想使用应用内计费来销售游戏关卡,但不想在用户每次开始玩关卡时都访问互联网。
market有没有缓存机制可以避免每次都调用服务器?我需要在我的应用程序上实现它吗?
I would like to know if the in-app billing api needs to have internet access when checking if the user have purchased an item or not.
I want to sell game levels using the in-app billing but don't want to access the internet everytime the user starts playing the level.
Does market have any cache mechanism to avoid calling the server everytime? Do I need to implement it on my app?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有两种类型的购买。托管和非托管。托管产品只能购买一次,但非托管产品可以购买任意多次。
市场应用程序没有这样的缓存。例如,您有一个托管产品 ID 设置,并且您作为用户已经购买了它。下次您请求市场应用程序购买同一商品时,它将返回一个响应,显示“已购买”。
对于非托管项目,它仅执行事务。
在这两种情况下,都需要互联网。
您可以自行决定如何在本地保存交易,并通过检查是否确实需要进行另一次购买来启动购买。
There are two types of purchases. Managed and unmanaged. Managed products can only be bought once, however unmanaged products can be bought any number of times.
There is no caching as such by the market app. Say for example, you have a managed product ID setup, and you a user has already bought it. The next time you request the market app to buy the same item, it will return with a response, saying "already purchased".
In case of unmanaged items, it just carries out the transaction.
In both the cases, internet is required.
It's upto you how you save the transactions locally, and initiate a purchase by checking if you really need to do another purchase.
您甚至不需要互联网许可即可使用应用内结算。市场会为你解决这个问题。
You don't even need the Internet permission to use in-app billing. Market will take care of that for you.