在应用程序购买中缓存或检查 Android 应用程序的每次启动?

Cache in app purchase or check on each start on Android app?

我的应用有一些应用内购买,每次都解锁应用的某些部分。

在应用程序中实际拥有购买状态的最佳方式是什么,但方式正确?:

  1. 在实际购买或恢复购买后,将购买存储在 SharedPreferences 上,并在应用启动时阅读。这可能会产生问题:在退款的情况下,应用程序将继续具有这些值。 root 用户可以编辑 xml 并按原样添加购买。

  2. 在应用程序启动时执行 queryInventoryAsync 并将结果存储为 SharedPreference 以供将来在应用程序中使用。这将允许在没有网络的情况下使用先前 queryInventoryAsync 结果中的 SharedPreference 值。

Because the Google Play client now caches In-app Billing information locally on the device, you can use the Version 3 API to query for this information more frequently, for example through a getPurchases call. Unlike with previous versions of the API, many Version 3 API calls will be serviced through cache lookups instead of through a network connection to Google Play, which significantly speeds up the API's response time.

那怎么办? queryInventoryAsync 是否会在每个应用程序启动时产生任何问题,因为它应该使用缓存的结果?

我在所有游戏的每个应用程序启动时都使用 queryInventoryAsync,到目前为止没有出现任何问题(20k 用户)。