Check if apk is newer than installed one

BasicBert

Member
Licensed User
Longtime User
Hi all,

Please help me out on this one :

I "distribute" my apk-file while developing through Dropbox to 2 or 3 of my own devices. I want the earlier installed app to check if there has been a newer version apk-file in the Dropbox.

I don't want the apk-file to be named including the version number, but just always the same same, like "myapp.apk" and I also do not want to use a separate textfile with the new version number in there, even though such a file would only contain a few bytes.

The "old" version number is of course already known by the "old" app, how can I check the new apk's version number before it gets installed?

For now, I just check the date of "myapp.apk" and see if it is newer than the datafile the app is using. If so, the new apk will be installed. This works, but is not correct, because the date of the apk will be changed by Dropbox (or DropSync that I also use to sync) to the sync-date and will not reflect the date the apk was made.
 

mc73

Well-Known Member
Licensed User
Longtime User
While I can understand the reason behind not using a text file, please consider that in the future you might want to include notes on your new versions changes, minor or major ones, giving the end user the choice to decide whether to download the current update or not.
 
Upvote 0

BasicBert

Member
Licensed User
Longtime User
I didn't mean to use this to publish my app, but only send it to some of my own devices for testing.

@Erel : The idea is that the new apk already is downloaded through Dropbox automatically. As you say it, you're correct that it's inefficient to download and then check the version. I just want to see if the already downloaded version is newer.

@mc73 : You are probably right. But I'm lazy :) I'll reconsider, because :

@thedesolatesoul : studying the XML file might cost more time and effort.

I was thinking that I would only check for an update for my direct developing purposes, but I'll have to look further away and think of distribution to others in the future.

So the small extra text file will be a good solution.


Thanks for the replies.
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
I didn't mean to use this to publish my app, but only send it to some of my own devices for testing.

@Erel : The idea is that the new apk already is downloaded through Dropbox automatically. As you say it, you're correct that it's inefficient to download and then check the version. I just want to see if the already downloaded version is newer.

@mc73 : You are probably right. But I'm lazy :) I'll reconsider, because :

@thedesolatesoul : studying the XML file might cost more time and effort.

I was thinking that I would only check for an update for my direct developing purposes, but I'll have to look further away and think of distribution to others in the future.

So the small extra text file will be a good solution.


Thanks for the replies.
I have another solution but it is not 100% ready yet. If you use my app (Cloudpipes), you will be able to download the file (it can perform one way sync), so it can check if the version on dropbox is newer and only then download it. After it is downloaded, it can send an intent (maybe an install intent, or an intent to your app), then you can do whatever you need to with your downloaded app. Fairly automated distribution mechanism.
 
Upvote 0

MrRey

Member
Licensed User
Longtime User
Could you include a small text file on the Dropbox folder that has the version and build numbers? I used to do that with a website. They actually just download a tiny text file and the app compares it to its own version.
 
Upvote 0

BasicBert

Member
Licensed User
Longtime User
I have another solution but it is not 100% ready yet. If you use my app (Cloudpipes), you will be able to download the file (it can perform one way sync), so it can check if the version on dropbox is newer and only then download it. After it is downloaded, it can send an intent (maybe an install intent, or an intent to your app), then you can do whatever you need to with your downloaded app. Fairly automated distribution mechanism.
I took a quick look at Cloudpipes and it seems usable. At least it gave the right idea to use one way sync, which is available in Dropsync also, as I discovered a few days ago. I just did not realise I could use it this way. Thanks for hinting. I'll have to setup all my devices for this one way sync mode, but that seems right for other purposes also.

I'll have to test some more, but I think my app can check for an apk-file in the synced folder, move it to a temperary folder and install from there. After installation the apk can be killed, without changing the other devices dropboxes. The next time an updated apk is put in the PC's Dropbox it will appear again in the synced folder and the process can be repeated.

Something like (pseudocode) :
B4X:
if apk in Dropsync then
  '(maybe ask or demand user to update)
  move apk to temp folder
  install apk
else
  if apk in temp folder then
     remove apk
  end if
end if
Could you include a small text file on the Dropbox folder that has the version and build numbers? I used to do that with a website. They actually just download a tiny text file and the app compares it to its own version.
This seems to be the best way when really distributing the app to people not allowed to share my dropbox. Which will probably not happen for the app I'm writing now.
When officially releasing an app in the Play Store, which at this moment I do not intend, I'll study Googles update mechanisms.
 
Upvote 0
Top