CheckAppVersion on GooglePlay

DonManfred

Expert
Licensed User
Longtime User
CheckAppVersion
Author:
DonManfred (wrapper)
Version: 1
AppVersion
Events:

  • version (newversion As String)
Methods:
  • CheckAppData (packagename As java.lang.String, lang As java.lang.String) As void
  • Initialize (ba As anywheresoftware.b4a.BA, EventName As java.lang.String) As void
Permissions:
  • android.permission.ACCESS_NETWORK_STATE
  • android.permission.INTERNET


Example
B4X:
Sub Process_Globals
    Dim app As AppVersion
End Sub
Sub Globals
End Sub
Sub Activity_Create(FirstTime As Boolean)
    app.Initialize("App")
End Sub
Sub App_version(newversion As String)
    Log($"App_version(${newversion})"$)
End Sub
Sub Activity_Resume
    app.CheckAppData("com.procoit.kioskbrowser","de")
End Sub

Known issues: it seems that it does not work for every app...
I started trying with com.whatsapp and org.telegram but these boths returns the String "Version may differ in different Android versions).


Anyway: Maybe it is of help for you to check your appversion on Googleplay to know if there is a newer version available.
 

Attachments

  • CheckAppVersionV1.0.zip
    316.1 KB · Views: 445

Inman

Well-Known Member
Licensed User
Longtime User
Known issues: it seems that it does not work for every app...
I started trying with com.whatsapp and org.telegram but these boths returns the String "Version may differ in different Android versions).

That is because developers have the option to upload different APKs for the same app, targeting different Android builds. Like 1 APK for API Level > 21 and one for the rest. When you check out such an app from Play Store, the Play Store app checks your API level and displays the version number of the app accordingly.

Anyway thanks for the library; another one that makes the life of a developer easier.
 

DonManfred

Expert
Licensed User
Longtime User
app checks your API level and displays the version number of the app accordingly
in this case we get a version number "depends on Android version" and not a real NUMBER.
Anyway thanks for the library; another one that makes the life of a developer easier.
you´re welcome
 

Inman

Well-Known Member
Licensed User
Longtime User
in this case we get a version number "depends on Android version" and not a real NUMBER.

On Play Store website, yes. On Play Store app on your phone it shows version number. For example Whatsapp version number on Play Store app on my phone is 2.16.396.
 

DonManfred

Expert
Licensed User
Longtime User
the lib is based on a snippet i found on SO
Maybe needs to be edited for such cases...

It get the html, get a specific dom-element and then get the value from it.

Maybe the version is shown in another div of the html-page in such cases
 
Top