Hi All,
Simple issue, or should have been.
AIM: to check if current App Version is the latest.
METHOD: When APK is loaded to Play store a text file containing the Version Code uploaded to Drop Box
When App starts, download text file, read the version code compare with Version Code in current App.
PROBLEM: With the following code [largely stolen from an Erel example] I don't get the text file but what appears to be the code for the web page.
Any help Greatly appreciated
Regards Roger
Simple issue, or should have been.
AIM: to check if current App Version is the latest.
METHOD: When APK is loaded to Play store a text file containing the Version Code uploaded to Drop Box
When App starts, download text file, read the version code compare with Version Code in current App.
PROBLEM: With the following code [largely stolen from an Erel example] I don't get the text file but what appears to be the code for the web page.
Simplified Code:
Sub Activity_Create(FirstTime As Boolean)
'
'Stuff
If FirstTime Then
'
'Stuff
'
Private Job As HttpJob
Job.Initialize("j", Me)
Job.Download("https://www.dropbox.com/s/6blkum2r49ey6vb/conver.txt?dl=0")
End If
'
'
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success Then
Private out As OutputStream = File.OpenOutput(File.DirRootExternal & "/Download/", "conver.txt", False)
File.Copy2(Job.GetInputStream, out)
out.Close '<------ very important
Private AppVer As Int = Application.VersionCode
Private VFunction As TextReader
Private Riedlyne As String
VFunction.Initialize(File.OpenInput(File.DirRootExternal & "/Download/", "conver.txt"))
Riedlyne = VFunction.ReadLine
Log("AppVer = "&AppVer)
Log("Riedlyne = "&Riedlyne)
If Riedlyne = Null Then Riedlyne = 0
If AppVer < Riedlyne Then
Msgbox2Async("Go to Play Store Now?","NEW UPDATE AVAILABLE","YES","","NO THANKS",Null,False)
Wait For Msgbox_Result (Result As Int)
If Result = DialogResponse.POSITIVE Then
StartActivity(PhoneIntents1.OpenBrowser("https://play.google.com/store/apps/details?id=b4a.configulator_calculator&hl=en"))
End If
End If
VFunction.Close
Else
'Log("Error: " & job.ErrorMessage)
End If
Job.Release
End Sub
Any help Greatly appreciated
Regards Roger