K
K
kirawa2018-04-17 09:39:53
Android
kirawa, 2018-04-17 09:39:53

How to inform the user about the update?

Good afternoon. I want to inform the user about the release of a new update immediately with a dialog showing "WHAT'S NEW".

Document document = Jsoup.connect("https://play.google.com/store/apps/details?id=" + MainActivity.this.getPackageName() + "&hl=it")
                        .timeout(30000)
                        .userAgent("Mozilla/5.0 (Windows; U; WindowsNT 5.1; en-US; rv1.8.1.6) Gecko/20070725 Firefox/2.0.0.6")
                        .referrer("http://www.google.com")
                        .get();
                Elements msgUpdate = document.select("div[itemprop=description]>content");
                Elements versionPlaystore = document.select("span.htlgb");
                String version = versionPlaystore.get(5).ownText();
                Log.d(TAG, version);
                String msg = String.valueOf(msgUpdate.get(1).toString()
                        .replaceAll("<content>","")
                        .replaceAll("</content>","")
                        .replaceAll("<br>","")).trim();
                return new String[]{version,msg};


..................

if (!versionName.equals(args[0])) {
                    showDialogUpgrade(args[1]);
                }

I just parse the html when starting the application and compare the version of the application with the version on play.google.com, and if they are not equal, then I show a dialog.
The problem is that play.google.com can change their layout. Is there any api for this?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Asoskov, 2018-04-24
@icqparty

I could be wrong, but any major service from google has api for google play too, from there you can get the current version number not directly from the application, of course, but through your server
, for example, getting information from google play api
https://github.com/ googlesamples/android-play-publ...

A
Alexey, 2018-04-26
@VDG

Well, they did. On your server, put a text file with the number of the latest version of your application, which was published in the player: "mysite.ru/app123.txt". And when you start the application, drag this file from the server and compare the line from it with BuildConfig.VERSION_CODE. Everything.
If you don’t have your own server, then you can use the free Firebase server (or take the version from its database or settings). Or use the same free GitHub server. Change the version code on your computer and commit.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question