问题
I'm trying to detect whether a user who has purchased my application through in-app purchase is in currently in Trial period or not.
For Apple (ios store) it was an easy flag which I could find in the receipt.
For Google Play, even though I'm making a server end call using the google play android developer API but the response itself does not contain any flags for me to understand whether the user is currently in paid or trial period.
Does any one have any smart suggestions of how to detect this in the google world?
回答1:
I checked the difference between initiationTimestampMsec and validUntilTimestampMsec. If it matches my configured trial period its trial.
回答2:
Actually it seems like this really ins't offered by V2 at the moment. The best alterantive that I have though of so far would be to keep track of the first time this purchase was made (e.g. reading it our from the first receipt that the user received for the purchase) and then comparing this timestamp to the current time using the duration of the trial period.
This can be read from trialPeriod
of the InAppProducts.get part for the respective productId.
https://developers.google.com/android-publisher/api-ref/inappproducts
If anyone has a better solution, I would be happy to read it here.
来源:https://stackoverflow.com/questions/24400527/detecting-whether-the-current-subscription-is-in-trial-for-google-play-store