I checked the current information on google or stack overflow. But the codes that exist now don't apply to my project.
try {
val curVersion: String = "1.0.5"
var newVersion: String? = curVersion
newVersion =
Jsoup.connect("https://play.google.com/store/apps/details?id=" + "com.lsn.lsn_communication_app")
.timeout(3000)
.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()
.select("div[itemprop=softwareVersion]")
.first()
.ownText()
if((curVersion) == (newVersion)){
storeVersion = "1.0.5"
}else{
storeVersion = "1.0.0"
}
} catch (e: Exception) {
e.printStackTrace()
storeVersion = ""
}
return storeVersion
This is my code to test the version. Does anyone know how to get the current Android app version of the Play Store in any way other than this?
My project is running a function asynchronously in a repository file using Retrofit 2.