question

Nethram avatar image
Nethram asked ·

How to check subscription expiration in fireTV android app

I have integrated IAP in my android fireTV app . App contains a monthly subscription IAP .To check subscription expiration app calls "purchaseupdate "method on "onresume" of launching activity .But "onpurchaseupdate" method not called every time in onresume of launching activity when app opens .

When home key is used to exit from app , app returns to the last activity next time app opens.

1)Calling "purchaseupdate" method in onresume of every activities is complicated .

2)How can I make sure app will always call "onpurchaseupdate" method ?

iapfire tvandroid
10 |2000 characters needed characters left characters exceeded

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

1 Answer

Levon@Amazon avatar image
Levon@Amazon answered ·

Hi Nethram,

Thanks for posting! I'd suggest you review your app's architecture. How many activities are in your app, and why does every activity need to check for subscription status? Does every activity display and use IAP items? If it's absolutely necessary to check that in every single activity, then I'd suggest creating a base activity that does that, and then having all your other activities derive from that class, that way they'd all inherit that subscription checking functionality. In most cases however, an app would not check IAP status every single time every activity opens. You could check that once on app launch, store those values in your app's preferences, maybe store a time stamp when you last checked, and in other activities simply read from your app's configuration. Again, there are several ways to approach this, and you should make your decision based on your app's architecture. Thanks!

10 |2000 characters needed characters left characters exceeded

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