Augusto Carmo
Augusto Carmo

Reputation: 4964

How to restore purchases on a second device (INAPP and SUBS)

I have the following situation:

A user purchases a subscription on an app on his device A. Later on, he buys a device B and configures it with the same account of device A. He installs that same app on device B, but the purchase he made on device A is not available there.

What can I do to make device B recognize the purchase? I tried using BillingClient#purchaseHistoryResponseListener, but even though it really returns the most recent purchases, it is not possible to say if the purchase is active (if it as a SUBS) or if it is not consumed yet (if it is a INAPP).

Upvotes: 3

Views: 1962

Answers (1)

esp
esp

Reputation: 156

If I am understanding your question correctly, you will have this information in queryPurchases(). As you already must know, this takes information from cache. So from device B you first need to make the queryPurchaseHistoryAsync() call, this refreshes the cache if this call is successful, and once it is, you can get the information you need in queryPurchases().

It has not been mentioned in the documentation that this method refreshes the cache, but this trick does seem to work for me and a bunch others if you refer here

Upvotes: 8

Related Questions