'Activity module
Sub Process_Globals 'These global variables will be declared once when the application starts. 'These variables can be accessed from all modules.
End Sub
Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module.
Dim PM As PackageManager
Dim SourceText1 As String
Dim Version1 As String
Dim Version2 As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim j As HttpJob
Dim n, m As Long
Dim Date1 As String
j.Initialize("", Me)
j.Download("https://play.google.com/store/apps/details?id=brainznl2.dsh") 'Change this to your own APK name
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
SourceText1=j.GetString
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",0) + 20
n = SourceText1.IndexOf2("<div class=" & Chr(34) & "IQ1z0d",n) + 18
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
m = SourceText1.IndexOf2("</span>",n)
If m>n Then Date1 = SourceText1.SubString2(n,m)
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
n = SourceText1.IndexOf2("<span class=" & Chr(34) & "htlgb" & Chr(34) & ">",n) + 20
m = SourceText1.IndexOf2("</span>",n)
Version1 = PM.GetVersionCode(GetPackageName)
If m>n Then Version2 = SourceText1.SubString2(n,m)
If Version1<>Version2 Then Msgbox("Current version is: " & Version1 & CRLF & "Playstore version is: " & Version2 & CRLF & "Uploaded: " & Date1,"Your App version is out of date")
Else
Log("Error")
End If
j.Release
End Sub
Sub GetPackageName As String
Dim r As Reflector
Return r.GetStaticField("anywheresoftware.b4a.BA", "packageName")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub