[Interest] Android service problem

Marek FloriaƄczyk marek.florianczyk at gmail.com
Thu Oct 13 18:12:31 CEST 2016


Hi all

This is my first mail to qt interest group. I'm working on an application which 
tracks and reports user movement over some period of time (2-3 hours)

I have two problems with Android Services.
First one is illustrated by this example:
https://github.com/frankipl/service-test

Application has service which simply counts seconds, it has QTimer with 1 
second interval which increments "counter" variable and sends it back to the 
application. Second counter is inside app and is simply QTime difference 
between time when service counter was started and "now" time. 
It seems to me that after a while (minute or so) android service goes to 
sleep, QTimer doesn't work and doesn't count seconds.
To replicate the problem: Install app, start it, reset counter, disconnect the 
usb cable from the phone, lock the phone, wait a minute or so, and unlock 
phone, counters will have different readings indicating that Android service 
wasn't working (counting seconds).
However if you keep the usb cable attached to the phone, service is working 
for a long time - no problem.

Second problem is with Qt5positioning. It crashes the service when I try to 
create default source, this is example:
https://github.com/frankipl/service-test-gps

In adb logcat you can see full output of SIG 11. Service crashes and then is 
restarted by the operating system and crashes again. 
If I use Qtpositioning inside the app, not service it works well.

I'm testing this on Qt 5.7 and Android 4.2.2, first problem also on Android 4.4 
and Android 6.0

I can report Qt Bug if it is a bug, but first I would like to have some 
confirmation.

Best Regards
Marek



More information about the Interest mailing list