Android stop service from C++
Unsolved
Mobile and Embedded
-
wrote on 1 Mar 2022, 17:25 last edited by UxoriousGhost 3 Jan 2022, 17:27
By referring to examples I'm able to start a service by calling "startService" method. But I'm not able to Stop the service.
My code to start service isQAndroidIntent serviceIntent(QtAndroid::androidActivity().object(),"myService"); serviceIntent.putExtra("name", name.toUtf8()); QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( "startService", "(Landroid/content/Intent;)Landroid/content/ComponentName;", serviceIntent.handle().object());
Code to stop the service
QAndroidIntent serviceIntent(QtAndroid::androidActivity().object(),"myService"); QAndroidJniObject result = QtAndroid::androidActivity().callObjectMethod( "stopService", "(Landroid/content/Intent;)Z;", serviceIntent.handle().object());
I'm getting error of no such method in android
-
wrote on 2 Mar 2022, 07:40 last edited by
Please have a look
https://github.com/denisgottardello/QtAndroidServiceExternalLib
where you can find how to start and stop a service
1/2