question

c716524 avatar image
c716524 asked Jonathan Ryan Grice answered

How to get notified when the subscription was changed on Clover Android app?

In case a user changes the subscription of a Clover Android app on one device, I experienced that on another device of the same merchant
CloverAccount.getAccount(this);
does not return the current but the former subscription. This is true as long as no Sync happens at this device or is manually done. I tested this and observed that these syncs don't seem to happen very often (I once waited 10 minutes, but no sync happened). If I do the manual sync then the current subscription is returned.
For the sake of best possible user experience I would prefer that the app shows the correct subscription immediately after a change happened on any device (asking the customer to press the sync button on several devices is not very user friendly). Is there a way to listen for an event in order to update my subscription screen within the app? I did not find any broadcast etc.
Additional question for better understanding: What happens when a sync happens? Is the Clover device storing the information about the Account locally and above code line just checks the local information in order to avoid a possibly lengthy asynchronous call to your servers?

Clover Android SDK
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jonathan Ryan Grice avatar image
Jonathan Ryan Grice answered

https://clover.github.io/clover-android-sdk/com/clover/sdk/v3/apps/AppBillingInfo.html

The SDK has a class that returns the current billing information. That may be what you're looking for instead of retrieving from getAccount.

1 comment
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

c716524 avatar image c716524 commented ·

Thanks, this class is definitely helpful and I managed to change my code so that the subscription overview in my app gets updated with every resume of the activity. However, I still experience issues in above scenario with multiple devices of a merchant, more specifically with the app market, where some information gets a bit messed up in certain clicking scenarios. Is there a way to change the current subscription with the AppBillingInfo class? Maybe even without the need to go the app market screen (in the Rewards app they managed to implement like this). In the main example (https://github.com/clover/android-examples/tree/master/checkappsubscriptionexample) you still have to wait for the Sync to happen as described in my original post.

0 Likes 0 ·

Welcome to the
Clover Developer Community