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

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

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

Post by liveCode » Sun Apr 10, 2022 9:23 am

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

Klaus
Posts: 13806
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

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

Post by Klaus » Sun Apr 10, 2022 9:49 am

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.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Sun Apr 10, 2022 4:48 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

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

Post by liveCode » Mon Apr 11, 2022 7:00 pm

So how do I do that?

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7215
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Mon Apr 11, 2022 8:13 pm

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.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

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

Post by liveCode » Tue Apr 12, 2022 7:40 am

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

SparkOut
Posts: 2839
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Tue Apr 12, 2022 9:31 am

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.

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

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

Post by liveCode » Tue Apr 12, 2022 3:26 pm

It works
Thanks

andresdt
Posts: 146
Joined: Fri Aug 16, 2019 7:51 pm

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

Post by andresdt » Tue Apr 12, 2022 4:18 pm

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

liveCode
Posts: 119
Joined: Sun Oct 17, 2021 5:53 pm

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

Post by liveCode » Tue Apr 12, 2022 7:39 pm

That's exactly what I did :lol:

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”