Page 1 of 1

How can I get the app to update it from another APK file?

Posted: Sun Apr 10, 2022 9:23 am
by liveCode
How can I get the app to update it from another APK file?
I am downloading the app with this command:

Code: Select all

libURLDownloadToFile
Then I want it to open and LIVECODE will install this app
Which is in this path:

Code: Select all

specialfolderpath ("documents") & "/" & "game.apk"
Thanks

Re: How can I get the app to update it from another APK file?

Posted: Sun Apr 10, 2022 9:49 am
by Klaus
I'm afraid this is not possible due to "Sandboxing" = the strict security settings of the Android OS!
If you think it over, you will understand that this is in fact a good thing! 8)

Your users will have to download the APK from a trustworthy source and install it on their machine by themselfes.

Re: How can I get the app to update it from another APK file?

Posted: Sun Apr 10, 2022 4:48 pm
by jacque
If you mean you want to update the user's copy of your own app, you can do that by making your app into a splash stack (a one-card app that opens a mainstack) and having it open the stack which is the actual working parts of your app.

When configured like this, updating would just need to download the latest version of the mainstack and replace the old one on disk. Then you can either ask the user to restart your app, or there's a way to use the revert command to do the same thing.

Re: How can I get the app to update it from another APK file?

Posted: Mon Apr 11, 2022 7:00 pm
by liveCode
So how do I do that?

Re: How can I get the app to update it from another APK file?

Posted: Mon Apr 11, 2022 8:13 pm
by jacque
Here is a lesson on how to create a launcher stack which is what we often call a "splash stack" because generally it only has one card with the app's splash logo.
https://lessons.livecode.com/m/4071/l/1 ... pplication
It talks about saving custom properties, but you don't need to do that necessarily. The basic idea is just that your working stack is a mainstack that is opened by the launcher app.

Re: How can I get the app to update it from another APK file?

Posted: Tue Apr 12, 2022 7:40 am
by liveCode
it does not work for me!
This is the code I put in the button:

Code: Select all

on mouseUp
   open stack (specialFolderPath("documents")&"/"&"Untitled 1.livecode" )
end mouseUp
And this is what I put in the inclusions:
ללא שם.png

Re: How can I get the app to update it from another APK file?

Posted: Tue Apr 12, 2022 9:31 am
by SparkOut
When you build the standalone, the included files are bundled into specialFolderPath("resources").
On running the app, you need first to check whether the correct fole already exists in the specialFolderPath("documents") location. If (and only if) it does not exist, then copy the files from "resources" to "documents". On mobile, the resources folder is not writeable, so the stack needs to be moved, but you need to check that you didn't already move it before, so as not to overwrite any changes saved.

Re: How can I get the app to update it from another APK file?

Posted: Tue Apr 12, 2022 3:26 pm
by liveCode
It works
Thanks

Re: How can I get the app to update it from another APK file?

Posted: Tue Apr 12, 2022 4:18 pm
by andresdt
liveCode wrote:
Tue Apr 12, 2022 3:26 pm
It works
Thanks
Hello
I read this thread and while I was reading it I got the following thought or idea :idea: .

If I create a launcher that checks to see if a stack exists on startup, in the resource folder. If it is not, the DOWNLOAD and then start it.
Then you wouldn't have to package the whole app in the compiled version just the launcher.

Just a thought out loud

Re: How can I get the app to update it from another APK file?

Posted: Tue Apr 12, 2022 7:39 pm
by liveCode
That's exactly what I did :lol: