Updated 26 October 2021
In this Blog, we will learn how to Get Current Version of the Application From Play Store.
Google does not provide any direct APIs for getting the current version from the play store and if there are then the process is too clumsy just to get version details.
But recently, the solution explained in this article, stopped working.
So, this blog is in continuation of the article shared above.
In the VersionChecker Class, you need to make some small changes in the “doInBackground()” method.
The New Version Checker class will be :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
public class VersionChecker extends AsyncTask<String, String, String> { private String newVersion; @Override protected String doInBackground(String... params) { try { Document document = Jsoup.connect("https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID + "&hl=en") .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(); if (document != null) { Elements element = document.getElementsContainingOwnText("Current Version"); for (Element ele : element) { if (ele.siblingElements() != null) { Elements sibElemets = ele.siblingElements(); for (Element sibElemet : sibElemets) { newVersion = sibElemet.text(); } } } } } catch (IOException e) { e.printStackTrace(); } return newVersion; } } |
Hope This Helps You.
Stay tuned, Stay Super.
Keep Coding and Keep Sharing 🙂
If you have more details or questions, you can reply to the received confirmation email.
Back to Home
13 comments
For the black screen issue fixation, you need to optimize the code.
private String newVersion;
@Override
protected String doInBackground(String… params) {
try {
Document document = Jsoup.connect(“https://play.google.com/store/apps/details?id=” + BuildConfig.APPLICATION_ID + “&hl=en”)
.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();
if (document != null) {
Elements element = document.getElementsContainingOwnText(“Current Version”);
for (Element ele : element) {
if (ele.siblingElements() != null) {
Elements sibElemets = ele.siblingElements();
for (Element sibElemet : sibElemets) {
newVersion = sibElemet.text();
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return newVersion;
}
}
I have try to this code but have getting null value only for play store version name
Please share the value of the BuildConfig.APPLICATION_ID
This Solution does not works as Google has updated their play store website and changed the dom structure, app versions are now hidden behind a modal that is dynamically loaded.
I am also looking for a solution.
Starting from today morning, this code is not working
(your code is working till yesterday)
now “newVersion” variable is just return null. may be play.google site is updated.
Could you please help!
Thanks million
I am also looking for a solution.
This Solution does not works as Google has updated their play store website and changed the dom structure, app versions are now hidden behind a modal that is dynamically loaded.
I am also looking for a solution.