Auto Update non-play store

Hi!

I am needing to update an apk without the use of play store, the situation is the following.

I am building an app that will run on a company without internet connection to collect information like a form app and unload the data via wifi, the problem is i wanna be able to update the aplication when the employees get into the wifi coverage (hopefully without user interaction) to avoid the need to access every tablet physically and do so!

Any help is really appreciated!

I had a similar problem recently, but with my LÖVE game, and there are no stores for them so yeah.

My solution was to post the version number somewhere on the internets (for being lazy I used pastebin) and compare that latest version with the one I have in the game. If the game is outdated show the user a dialog to download the newest version.

-- https://github.com/TomK32/Poppy/blob/master/check\_of\_updates.lua local http = require 'socket.http' local latest\_version\_url = 'http://pastebin.com/raw.php?i=v0jPMYRX' local game\_url = 'http://ananasblau.com/poppy/' game = {version = '1.2' } local response = {} a,b,c = http.request({url = latest\_version\_url, sink = ltn12.sink.table(response)}) local latest\_version = response[1] -- see if it a valid string like 1.2.345 and if the version is newer if (string.find(latest\_version, '%d%.%d%.%d+') == 1 and game.version latest\_version) then return {version = latest\_version, url = game\_url} end return false 

It uses socket.http because LÖVE doesn’t have https but Corona does, in case you need it.

 

Thanks for your quick response!

Very helpful but i am having trouble with the downloading and saving the file also with the restarting the aplication.

So i could just download the file to /data/app/com.corona.test.apk ? will it work?

Here’s a theory of mine (note the three /// ). Don’t forget to delete the file after installing it.
 

system.openURL('file:///path/to/file.apk') 

http://docs.coronalabs.com/api/library/system/openURL.html

Will try your suggestion tonight and report back any progress!

Thank you very much!

I had a similar problem recently, but with my LÖVE game, and there are no stores for them so yeah.

My solution was to post the version number somewhere on the internets (for being lazy I used pastebin) and compare that latest version with the one I have in the game. If the game is outdated show the user a dialog to download the newest version.

-- https://github.com/TomK32/Poppy/blob/master/check\_of\_updates.lua local http = require 'socket.http' local latest\_version\_url = 'http://pastebin.com/raw.php?i=v0jPMYRX' local game\_url = 'http://ananasblau.com/poppy/' game = {version = '1.2' } local response = {} a,b,c = http.request({url = latest\_version\_url, sink = ltn12.sink.table(response)}) local latest\_version = response[1] -- see if it a valid string like 1.2.345 and if the version is newer if (string.find(latest\_version, '%d%.%d%.%d+') == 1 and game.version latest\_version) then return {version = latest\_version, url = game\_url} end return false 

It uses socket.http because LÖVE doesn’t have https but Corona does, in case you need it.

 

Thanks for your quick response!

Very helpful but i am having trouble with the downloading and saving the file also with the restarting the aplication.

So i could just download the file to /data/app/com.corona.test.apk ? will it work?

Here’s a theory of mine (note the three /// ). Don’t forget to delete the file after installing it.
 

system.openURL('file:///path/to/file.apk') 

http://docs.coronalabs.com/api/library/system/openURL.html

Will try your suggestion tonight and report back any progress!

Thank you very much!