Service not started
I have followed the guide here and added a service to my project. The app compiles and runs without any problems but it seems I can not start the service.
I have a debug message in the main loop to see if it has started. But nothing is printed in the debug window after trying to start the service, neither the message nor an error.
What might be wrong? How can I debug this situation? I checked all the names and entries a couple times if they match and it all seems to be correct. What should I check further? Thank you.
What service are you talking about ?
On what platform ?
With which version of Qt ?
@vlada Are you sure it's not starting? Android may be running the service but there may be a permission or some other issue with the debug statement.
Can you check the process list on your android device and see if it is running?
As for debugging check the syslog after trying to start it and see if there are any issues there.
@SGaist I'm talking about Android service, as described in the guide by Bogdan Vatra I mentioned.
@ambershark I was trying to check if the process is running but I couldn't find any application which would show it. I couldn't find an Android app similar to Process Explorer in Windows. How do I check the syslog? Thank you and I'm sorry for these trivial questions, I'm really not familiar with debugging something on Android.
@vlada Well first off connect to your device with adb.. then you can run standard linux commands (mostly). Like so:
$ adb shell ... should now be connected to your device Now you can check processes with ps: $ ps -p (in linux I use ps -elf) not sure what ps -p will do in android, check ps --help for more info You can then also check your logs with: $ logcat
Here's more info on the logcat command:
Had a highlighting glitch which made me miss the link.
But again, which version of Qt are you using ?
And what Android version is giving you trouble ?
@SGaist I'm using the latest version of Qt 5.9 and QtCreator 4.4 with various Android versions (mostly Marshmallow). But the problem was caused by a fault in my code.
@ambershark Thanks for those tips. It helped me to identify that the service is really not running.
I used the whole service part from the demo program and made it to work after a lot of attempts. Now I'm slowly changing the code to adopt it to my needs while checking that the service is still running.
What makes it difficult is the fact that there are only very few useful messages telling me what's wrong. I also realized that if I use qDebug() in the service, the output won't appear in the console window. That is strange.
This problem was described in this bug report. It should have been fixed since QtCreator 4.3.1 but it still doesn't work in my 4.4.
Anyway now it works and I will have to find out how to create a service from a class. At least it is running now so I can work on it. Thank you for your help.