Hello Don,For anyone who have problems setting it up. Here is a little example. It updates itself from 1.0 to 1.2 after click on a button.
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
... 'any specific code for your app initialization
End If
Activity.LoadLayout("Main")
.... 'more stuff
If FirstTime Then
apkupdt.Initialize(Me,"tab1") 'tab1 has no meaning; use any name you like
'this is yor app's package name (see "Project/Package name")
apkupdt.PackageName = "eu.dgconsulting.tmb"
'this is the complete path to the text file holding the newer version number
apkupdt.NewVerTxt = "http://umbetest.web44.net/p_apk/tmb.txt"
'this is the complete path to your newer apk
apkupdt.NewVerApk = "http://umbetest.web44.net/p_apk/tmb.apk"
apkupdt.UserName = "test" 'needed since folder p_apk has access restrictions
apkupdt.UserPassword = "test" 'as above
'not needed- just to show use of function GetCurVN
Log("I am version: " & apkupdt.GetCurVN)
'use only if you like to show a splash screen while update checking goes on
apkupdt.SetAndStartSplashScreen(Activity,LoadBitmap(File.DirAssets, "tmb0.png"))
'this function starts checking for any newer version of the current app
apkupdt.LookForNewVersion
End If
End Sub
My app doesn't use okHttp or okHttputils2... (too busy to update all sections that works fine now..).Hi all,
you won't believe it but finally I had some time to update my lib! Please download all relevant files from post #1.
Version number jumped from 1.26 to 1.30 due to a few experiments and personalized versions; this is simply to say that you didn't miss any valuable update.
So, what's new with version 1.30? Not so much, but it now finally makes use of okHttp (version 1.01) and okHttpUtils2 (version 2.20).
A word of caution: AppUpdating version 1.30 was compiled with B4A 4.30, so you may want to recompile it from its source code.
I tried to replicate problems from posts #198 (missing info file) and #211 (version row with wrong format) but wasn't able to crash the app.
As soon as possible I will align AppUpdatingLFD (the Large File Download counterpart) to this same version 1.30.
AutoUpdate example code now refers to a different server of mine. The change was mainly due to previous hoster having changed its server configuration in a way that ".apk" files became unreachable. This note may comes handy if suddenly you experience a similar, unexpected behavior..
udg
apkupdt.NewVerTxt = "http://197.189.XXX.XXX/eBuki/Updates/AppUpdateEbuki.txt"
Status: -100
Thanks, after Googling into the unknown.......I finally have the solution.Hi @Declan
Status = -100 is caused by httputils (any reason, from connection refused to file not found).
In my experience, the folder containing files to be served by the webserver should be located in the root path of it. I mean that if the webserver at address 197.189.xxx.xxx has its root at c:\xampp\htdocs then it is able to serve files from folders like c:\xampp\htdocs\eBuki\Updates.
I am not 100% sure of the above, but try to copy the exact string from apkupdt.NewVerTxt to the URL bar in your browser. If the browser can reach the file so should the lib. Let me know.
udg
Also, don't forget to add the MIME type - "application/android":
** Activity (main) Pause, UserClosed = false **
** Activity (appupdate) Create, isFirst = true **
---- AppUpdating.ReadCurVN
Current Version: 1.01
---- AppUpdating.ReadWebVN
** Activity (appupdate) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
---- AppUpdating.JobDone --
JobName = JobWebVNonly, Success = true
Read while in JobWebVNonly: ver=1.02
Web version number: 1.02
webvnl: 4
---- AppUpdating.ReadCurVN
UpdateComplete - time: 11:09:07
Running apk version: 4.15
---- AppUpdating.ReadWebVN
** Service (httputils2service) Create **
** Service (httputils2service) Start **
---- AppUpdating.JobDone --
UpdateComplete - time: 11:09:08
Webserver apk version: 4.16
Optional Change Log data:
V4.1.6:
Added support for automatic updating.
---- AppUpdating.UpdateApk
---- AppUpdating.JobDone --
-- JoWebVNcompare
-- ApkUpdate
---- AppUpdating.JobDone --
Error: java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer)
UpdateComplete - time: 11:09:57
Status: -100
** Activity (main) Pause, UserClosed = true **
** Service (servicemain) Destroy **
** Service (servicetxrx) Destroy **
** Activity (main) Create, isFirst = false **
** Activity (main) Resume **
** Service (servicemain) Create **
** Service (servicemain) Start **
releasing KeepAlive
No wakelock.
turning screen on
using partialLock
** Service (servicetxrx) Create **
** Service (servicetxrx) Start **
---- AppUpdating.ReadCurVN
HANGS HERE....
Nevermind, I have to call the initialize every single time even outside of if Firsttime.I have noticed a bug thats driving me nuts.
---- AppUpdating.ReadCurVN Hangs, and never fires the event if I reopen the app.
If I kill the app and restart it from scratch, it works.
But When it works, I get this:
B4X:---- AppUpdating.ReadCurVN UpdateComplete - time: 11:09:07 Running apk version: 4.15 ---- AppUpdating.ReadWebVN ** Service (httputils2service) Create ** ** Service (httputils2service) Start ** ---- AppUpdating.JobDone -- UpdateComplete - time: 11:09:08 Webserver apk version: 4.16 Optional Change Log data: V4.1.6: Added support for automatic updating. ---- AppUpdating.UpdateApk ---- AppUpdating.JobDone -- -- JoWebVNcompare -- ApkUpdate ---- AppUpdating.JobDone -- Error: java.net.SocketException: recvfrom failed: ECONNRESET (Connection reset by peer) UpdateComplete - time: 11:09:57 Status: -100 ** Activity (main) Pause, UserClosed = true ** ** Service (servicemain) Destroy ** ** Service (servicetxrx) Destroy ** ** Activity (main) Create, isFirst = false ** ** Activity (main) Resume ** ** Service (servicemain) Create ** ** Service (servicemain) Start ** releasing KeepAlive No wakelock. turning screen on using partialLock ** Service (servicetxrx) Create ** ** Service (servicetxrx) Start ** ---- AppUpdating.ReadCurVN HANGS HERE....
LogCat connected to: 30044ad22ed23200
--------- beginning of /dev/log/main
--------- beginning of /dev/log/system
** Activity (main) Create, isFirst = true **
Config Version: v210
Expected: v210
** Activity (main) Resume **
** Service (servicemain) Create **
** Service (servicemain) Start **
releasing KeepAlive
No wakelock.
turning screen on
using partialLock
** Service (servicetxrx) Create **
** Service (servicetxrx) Start **
---- AppUpdating.ReadCurVN
UpdateComplete - time: 11:15:00
---- AppUpdating.ReadWebVN
** Service (httputils2service) Create **
** Service (httputils2service) Start **
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL (****BLANKED OUT HERE****) was not found on this server.</p>
<hr>
<address>Apache/2.4.16 (Win32) OpenSSL/1.0.2d PHP/5.5.12 Server at BLANKED FOR PRIVACY Port 80</address>
</body></html>
---- AppUpdating.JobDone --
Error: Not Found
UpdateComplete - time: 11:15:01
Status: -100
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
** Service (newinst2) Create **
---- AppUpdating.newinst2: service created
** Service (newinst2) Start **
---- AppUpdating.newinst2: service_started
'ALWAYS NEEDED - this is your app's package name (see "Project/Package name")
apkupdt.PackageName = "b4a.example.appupdate"
'ALWAYS NEEDED - this is the complete path to the text file holding the newer version number
apkupdt.NewVerTxt = "http://www.dgconsulting.eu/free_apk/AppUpdateExample.inf"
'ALWAYS NEEDED - this is the complete path to your newer apk
apkupdt.NewVerApk = "http://www.dgconsulting.eu/free_apk/AppUpdateExample.apk"
'OPTIONAL - Set credentials to access a protected folder. Not needed for this example
apkupdt.setCredentials("test","test")
apkupdt.PackageName = "b4a.example.appupdate"
apkupdt.NewVerTxt = "http://yourserver/YourTestFile.inf"
apkupdt.NewVerApk = "http://yourserver/YourTestFile.apk"