简体   繁体   English

Android应用内购买易耗品

[英]Android In-App Purchase of consumable

I've implemented Google's Billing Services API in my current app. 我在当前应用中实现了Google的Billing Services API。 I have several items that are consumables due to their nature. 由于其性质,我有几项消耗品。 For example, if the user buys consumable AA, the costumer gets 20 coins. 例如,如果用户购买了耗材AA,那么客户将获得20个硬币。 I'm currently storing that value of 20 coins on the user's device. 我目前正在用户设备上存储20个硬币的价值。 Is there a way to store this value in Google's servers? 有没有办法在Google的服务器中存储此值? The reason I'd like to do this is because if someone roots their device, they can make the purchases, then make a copy of the file that stores the consumable content and keep restoring the file as they use the consumables in the app. 我之所以要这样做,是因为如果某人植根了他们的设备,他们可以进行购买,然后制作一个存储消耗品内容的文件副本,并在他们在应用程序中使用消耗品时继续还原该文件。 I have encrypted the data stored in the file making it difficult to make changes to it, but you can make a back up and restore as they wish. 我已经加密了存储在文件中的数据,因此很难对其进行更改,但是您可以根据需要进行备份和还原。 If you have other suggestions, please let me know. 如果您还有其他建议,请告诉我。

Thank you, A 谢谢阿

If it is a managed item, then purchase history is stored by google, and you can make queries to their API to find out how much currency the user has purchases. 如果是托管商品,则购买历史记录由Google存储,您可以查询其API,以了解用户购买了多少货币。 However, you will need to track expenditure separately on your own servers, as otherwise whenever you query the purchases, you'll end up crediting the user with that amount, regardless of how much they've acquired. 但是,您将需要在自己的服务器上分别跟踪支出,否则,无论何时查询购买,最终都将以该金额记入用户的帐户,而不管他们获得了多少。

In short, Google does not provide a nicely tailored system for this. 简而言之,Google并未为此提供量身定制的系统。 For security, you're better off storing details on your own server, or encrypting them on the device as you noted. 为了安全起见,最好将详细信息存储在自己的服务器上,或者如您所述在设备上加密它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM