I am using this code to get the Google Play Store app version but this is causing my app to hang. Please specify another way to get the app version or how I can use this code to
Change this two lines
{
newVersion = Jsoup.connect("https://play.google.com/store/apps/details?id=" + "package name" + "&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")
....
you are using BuildConfig.APPLICATION_ID
but you need package_name
BuildConfig
is provided by Gradle. If you are not building using Gradle
then you cannot access the package name using BuildConfig
.
I would use Context.getPackageName()
because the result is provided from the operating system, rather than a constant in build parameters.