Subscribe to updates in the application in android

I implemented an in-app purchase for a subscription product, it works great. I set 1 month subscription for each product, and it will be updated in 1 month.

Now my question is: is there a way to get an updated list of products and an extension date?

Does Google provide any service or event through which we can learn about the extension.

+8
android
source share
2 answers

Unfortunately, In-app Billing API v3 does not provide any events or ways to notify you of an update or unsubscription.

The only thing you can do is manually request the API to get the currently activated subscription. (This is true for the Android API as well as http-based ...)

A way to do this from an Android client:

  • Request an inventory, as you usually do, to get a list of products with IabHelper#queryInventory(boolean querySkuDetails, List<String> moreItemSkus, List<String> moreSubsSkus)

  • If the user has an active subscription, you can purchase using IabHelper#getPurchase(String sku) . The purchase will contain information about the status and time of the subscription. (doc here )

To do this using the Google Play Developer API (from your service), you must use get , the information will be in the ressource .

+6
source share

I have not received an answer, but received what I share with you all. After many studies, I found out that there is no broadcast or service through which we can know that the product has been updated or canceled.

Using billingService.getPurchases I received all the purchases of the current user.

 Bundle bundle = billingService.getPurchases(3, getPackageName(), "subs", null); 

This gives me a list of signed items with the following details.

  INAPP_PURCHASE_ITEM_LIST RESPONSE_CODE INAPP_PURCHASE_DATA_LIST INAPP_DATA_SIGNATURE_LIST 

From the above details, I received the aurenew status, purchase date, orderId, package name, buyTime, purchaseState, purchaseToken.

from all the information, at least I can know when the product was purchased, the weather / weather auto-correction is on / off.

If a user cancels autoRenew from the Google Play Store, his loop will be completed and will receive benefits until the end date of the subscription.

after reaching the end date of the subscription, if autoRenew is false, the user will not receive any benefits associated with this product / purchase / subscription.

+1
source share

All Articles