Android Question In-App billing get subscription expiry ?

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Hello all,

As far as I know , In-App billing library does not return subscription expiry date so I am asking what can we do to get it ?

I have a mysql users table where I would like to store the expiry date in

How do you guys deal with subscription expiry ?

Thanks in advance
 

DonManfred

Expert
Licensed User
Longtime User
i guess you do define it in the billing settings, right?
Store a list of all your products (using their id) with the defined expire time. Use the known list when checking the used products.

Never used in-app-billing in my apps so it is just a guess/suggestion
 
Upvote 0

somed3v3loper

Well-Known Member
Licensed User
Longtime User
Thanks Don ,
But I am not sure I understand your suggestion
Billing library does not return expiry date of the in-app subscription
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
But you can get .PurchaseTime? If you have fixed time periods it would be easy to calculate?
 
Upvote 0

somed3v3loper

Well-Known Member
Licensed User
Longtime User
But you can get .PurchaseTime? If you have fixed time periods it would be easy to calculate?
Right I have fixed time periods but I think I read that this time won't change even if user has re-subscribe so in this case how can I know the new expiry date ?
 
Upvote 0

rboeck

Well-Known Member
Licensed User
Longtime User
10 minutes before i thought, i have to consume the oldest purchase and then i get the next one, but in the meantime i found out, that's impossible to consume an subscription.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
10 minutes before i thought, i have to consume the oldest purchase and then i get the next one, but in the meantime i found out, that's impossible to consume an subscription.
That's because a subscription is valid until the expiry date, even if the user has canceled it. You don't need to consume it anyway because renewals are handled by Play Store, not your app.

All you need to do is check the status of the subscription when the app starts & take action in the app accordingly.

- Colin.
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
If I want my premium content to be available offline , what do you suggest ?
Well I save a copy of the subscription status on the device & use it as a fallback if I can't get a status from Play Store. Every time the app starts I try to check the status & if I get a response from Play Store I update my local copy of the status. If I can't get a response, I use the last known state. I don't go as far as storing it in a database, I just write it to a config file in DirInternal. I figure the average user doesn't have the knowledge to hack DirInternal to try & get a free subscription - & even if they do, the subscription state will get updated every time they start the app.

- Colin.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…