Checking for latest version

i am currently writing an ANT script which will include some intelligence to check for things. I am using SnapshotCM from True Blue Software as my version control and using CruiseControl as a framework for my nightly build. Basically, I will need to always check for the latest version found in my version control and execute commands. In this case here is an example:

In the code above, I will load the "" file. The algorithm should be as follow:

load the initial properties file

get the build_number

increment build_number by 1 (let this new variable be X)

if X is found, increament X by 1 (if not found jump to 6.)

if X is found, repeat 4 (until X cannot be found)

else use the build number inside the

The file is as follow:

can anyone guide me on that?

1 Answer 1

Ant is not a programming language. It’s a dependency matrix language.

That means you don’t specify execution order in Ant. Ant will calculate the order it needs to run the targets. It also means Ant doesn’t have the ability to do loops, or even change the value of a property once it is set.

There are a few packages that build upon Ant. The old standby is the Antcontrib. Antcontrib has the concept of variables which are like mutable properties. It also has various looping structures. However, I’m not sure if the or tasks will do what you want.

Searching sequentially for the next build number is something you can do in a shell script. In fact, I highly recommend this.

Trying to honor a feature request from our customers, I’d like that my application, when Internet is available, check on our website if a new version is available.

Читайте также:  Гарантия на галогеновые лампы

The problem is that I have no idea about what have to be done on the server side.

I can imagine that my application (developped in C++ using Qt) has to send a request (HTTP ?) to the server, but what is going to respond to this request ? In order to go through firewalls, I guess I’ll have to use port 80 ? Is this correct ?

Or, for such a feature, do I have to ask our network admin to open a specific port number through which I’ll communicate ?

@pilif : thanks for your detailed answer. There is still something which is unclear for me :

Then you can return what ever you want, probably also the download-URL of the installer of the new version.

How do I return something ? Will it be a php or asp page (I know nothing about PHP nor ASP, I have to confess) ? How can I decode the ?version=1.2.4 part in order to return something accordingly ?

12 Answers 12

I would absolutely recommend to just do a plain HTTP request to your website. Everything else is bound to fail.

I’d make a HTTP GET request to a certain page on your site containing the version of the local application.

Then you can return what ever you want, probably also the download-URL of the installer of the new version.

Why not just put a static file with the latest version to the server and let the client decide? Because you may want (or need) to have control over the process. Maybe 1.2 won’t be compatible with the server in the future, so you want the server to force the update to 1.3, but the update from 1.2.4 to 1.2.6 could be uncritical, so you might want to present the client with an optional update.

Читайте также:  Сервер служащий для хранения файлов

Or you want to have a breakdown over the installed base.

Or whatever. Usually, I’ve learned it’s best to keep as much intelligence on the server, because the server is what you have ultimate control over.

Speaking here with a bit of experience in the field, here’s a small preview of what can (and will — trust me) go wrong:

  • Your Application will be prevented from making HTTP-Requests by the various Personal Firewall applications out there.
  • A considerable percentage of users won’t have the needed permissions to actually get the update process going.
  • Even if your users have allowed the old version past their personal firewall, said tool will complain because the .EXE has changed and will recommend the user not to allow the new exe to connect (users usually comply with the wishes of their security tool here).
  • In managed environments, you’ll be shot and hanged (not necessarily in that order) for loading executable content from the web and then actually executing it.

So to keep the damage as low as possible,

  • fail silently when you can’t connect to the update server
  • before updating, make sure that you have write-permission to the install directory and warn the user if you do not, or just don’t update at all.
  • Provide a way for administrators to turn the auto-update off.

It’s no fun to do what you are about to do — especially when you deal with non technically inclined users as I had to numerous times.

A guide to creating android apps on mobile using Sketchware App.

Check for latest app version using Firebase in Sketchware

  • Get link
  • Facebook
  • Twitter
  • Pinterest
  • Email
  • Other Apps

You can store the latest version of your app in Firebase realtime database, and then check and compare it with the actual version of installed app. Follow the instructions below to know how to do this.

Читайте также:  Как в виндовс 10 убрать автозагрузку программ

1. In your Firebase app in sketchware, in library manager, make sure you have entered correct App ID and project ID, and that Firebase switch is on.

2. Make sure the rules in your Firebase database are read and write true.

3. On the MainActivity or the Activity in which you want to check for the latest app version, add a new FirebaseDB component called Ver:version.

This code sets the string your_version to version of the installed app.

7. Next in onCreate use add source directly block and put following code.
DatabaseReference rootRef = _firebase.getReference(); rootRef.child("version").addListenerForSingleValueEvent(new ValueEventListener() <
public void onDataChange(DataSnapshot snapshot) <
if (snapshot.exists()) < >else <

This code checks if the FirebaseDB component version exists in the database. If it doesn’t exist then push the version of installed app to the database. Use following blocks next.

8. Add a new Map List map1.

9. Add event FirebaseDB:Ver onChildAdded.
* In this event, get children from firebase database to Map List.
* Then set the string latest_version to key v at position 0 of the Map List.
* Then if latest_version is greater than your_version, toast a message that update is required. You can also display a dialog instead of toast and prompt user to update the app. Or you can use intent to directly lead the user to update url.
* Else if your_version is greater than latest_version, update the version in database using following code:

To accomplish this in FirebaseDB:Ver onChildAdded use blocks as shown in image below.