Pong

August 27th 2014, Qt Android Activity

August 24th 2014 Test Run | | August 27th 2014 Valgrind

Qt on Android uses an Android activity to start the qt eventloop. In order to record GPS tracks, the event loop of the GPS recording app should be running in the foreground as long as the tracks are recorded.

Since GPS recording is a long-running task, an Android service would be optimal for GPS recording, but unfortunately Qt 5.3 does not provide a standardized way to write such a service yet. At the time of this writing Qt for Android only supports Android activities as by the following Qt java code:

/opt/Qt5.3.1/5.3/android_armv7/src/android/java/src/org/qtproject/qt5/android/bindings/QtActivity.java

One could modify the above activity sources to start a service, but this is pretty experimental. I’ve read that it has been done successfully, but I am not going to excercise that before it gets the official thumbs up from Bogdan.

So for the moment we are restricted to an Android activity. If we press the home button, the actual activity is moved to the background. There is a good chance that it keeps running in the background until the user brings the app back to the foreground, but in principle the Android system can stop or even kill a background activity at any time to free resources.

In fact, I have found that a phone call will likely end all background activities and I have also found that a background activity does not survive much longer than a couple of minutes, if other apps are started. I also suspect that any background activity is automatically stopped after being idle for longer than 10 minutes or so.

As a consequence, we need to keep the app in the foreground, to record GPS tracks continuously, but even then a phone call may stop it.

I am eagerly awaiting Android services being integrated into Qt!

August 24th 2014 Test Run | | August 27th 2014 Valgrind

Options: