I have written an app for my salesmen. I have no problems downloading sqlite-tables and updating all the necessary data.
But is there a way updating the app by ftp too? I have changes nearly every week. I do not want to publish the app its for internal use only.
Yes. You can download the APK file, copy it to the storage card and then send an intent that will install it.
This is the intent:
B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal, "temp.apk"))
i.SetType("application/vnd.android.package-archive")
StartActivity(i)
Hi,
im quite new to b4a and am very interested in including an update function from my website.
I thought of putting a version file next to the apk file in an folder on my website and have the app compare it with an internal version number. Does this make sense? How does one usually do this?
Also I would need some more directions to downloading the new app (via simple HTTP and not FTP) and then replace the old one by installing it and then delete the temporary downloaded app. Can I simply use the HTTP client to get it and then store the responsetext as .APK file? Is there any "nicer" way to do this?
Thanks a lot!
Nickelgrass,
You can simply use HttpUtils.Download & HttpUtils.GetString
1) Holding the current version number in simple text file on your web server
2) Download this file with HttpUtils.Download
3) Read contents with HttpUtils.GetString
4) Check against installed version
5) If installed < current then
6) Download new 'apk' file with HttpUtils.Download
6) Install
So far everything is working except one thing. I am using the Httprequest and initializeget to download the apk file. But the filesize I am receiving in the Response.GetString("UTF8") is not the correct size (it is ~99K instead of ~105K).
When I download the file from Android browser the size is ok. What am I doing wrong. (I do not want to use the Httputils.)
Thanks a lot!
Thanks for the replies!
In case anyone is interested I would like to share the solution:
I looked into the Httputils and simply used the same method in my app with Response.getasynchrounously. That worked fine and is simple.
Please do! I have been working on this for about 3 hours and just can't seem to wrap my head around it. I have the apk file on my server and I THINK I am downloading it but am not sure.
Dim b As String
b=UpdateJob.GetString
File.WriteString(File.DirDefaultExternal, name,b)
to copy the file, but I think that here things went wrong as I should not use ASCII but Binary mode? (I get a parser error)
In other words, how do I copy the file from job.getstring to the SD card?
Yes. You can download the APK file, copy it to the storage card and then send an intent that will install it.
This is the intent:
B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal, "temp.apk"))
i.SetType("application/vnd.android.package-archive")
StartActivity(i)
Hi Nickelgrass. Did you ever share the solution to update an APK using FTP? I don't see any attachments on this thread. I'm struggling with this and would appreciate an example.
There are two unrelated parts to this task. First you need to download the APK to the external storage and then you need to send the intent that will install it.
You can setup an Google-Dev-Account and then you can put the App in beta-status and then you can Publish it for selected persons. But the app seems to have to be always beta i i read that correctly on googles Website.