Android stop service from C++
Unsolved
Mobile and Embedded
-
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
-
Please have a look
https://github.com/denisgottardello/QtAndroidServiceExternalLib
where you can find how to start and stop a service