Android In-App-Purchase, how to check if user have purchased one item

前端 未结 4 1068
醉梦人生
醉梦人生 2021-02-13 01:20

is that OK and safe to set a value in SharedPreference to flag that the user have purchased this item? What if user hack this value in SharedPreference. Or I need to connect IAP

4条回答
  •  庸人自扰
    2021-02-13 02:05

    from the documentation:

    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.

    Which basically means you can look up the purchase each time and the Play Store app will respond pretty much right away.

提交回复
热议问题