Search code examples
androidin-app-subscription

Is there any way to retrieve if user had canceled Android In App subscription


I am using google in-app billing v-3 to implement Subscription.

My Subscription has one week Trail period and UI displays "Avail A Week Free" View.
If the user Subscribes and cancels for any reasons, I need to display "UpGrade" View.

As far as I googled, I learned that if users cancel's subscription while in the period of active subscription, INAPP_PURCHASE_DATA_LIST autoRenewing flag will return false.And after the subscription period ends getPurchase() could return empty.

In this scenario how could I know which UI to display, hence getPurchase() will return empty for both, when the subscription expires and when User has not Subscribed.


Solution

  • Since any user can use trial only once you can check getPurchaseHistory() and see if the user has ever been subscribed to your subscription. If he was - you need to show "UpGrade" view, otherwise, you can show "Avail A Week Free" View.