Code for app version check and "force" user to update

Hello,

Is anyone could give me a hint on how to integrate a check in my app that verifies the version available on google play and request user to update?

Thanks in advance :slight_smile:

You’ll need to store the latest version online (db or text file) and then check against that. You’ll need to remember to update that value with each new release.

Indeed , but my real question is how to retrieve from Google play the published version?

I imagine it’s all about opening the google play URL and get the version from the answer but I absolutely don’t know how to do that… in LUA or any other language LOL

Is anyone able to give me an example of this?

You could perform a network request and download your app’s Google Play site data, and then scrape it for the version number.

This approach would, however, be very wasteful and if your users are on a limited data plan then they wouldn’t be happy with what you are doing.

aoutch… I thought more about getting this info from the HTML page or something.
Or an API that I do not know from Google play.

Dowload again the app sounds not like a good solution indeed.

That’s what I said, you’d download the Google Play site data for your app and scrape it. I didn’t say you’d download the entire app.

ho ok… missunderstood sorry.

Ok so, it would be something like opening the URL and parse the HTML then. Not sure how to that in a reliable way yet

The problem is that there isn’t a guaranteed way.

You can use a network request to download the contents of the page and then you’d just look for where the version information is via string library, for instance.

However, the cleanest way to approach this would be to do as SGS suggested and have your own little backend/API that just returns the version number to you.

I think the best way would be storing the version locally and comparing it to the one you keep online. Don’t forget to update each one though :slight_smile:

Thanks for your answers :slight_smile:

Will do that then !

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.