Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Android stop service from C++

Android stop service from C++

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
android serviceserviceactivity
2 Posts 2 Posters 539 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    UxoriousGhost
    wrote on last edited by UxoriousGhost
    #1

    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 is

    QAndroidIntent 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

    1 Reply Last reply
    0
    • mrdebugM Offline
      mrdebugM Offline
      mrdebug
      wrote on last edited by
      #2

      Please have a look
      https://github.com/denisgottardello/QtAndroidServiceExternalLib
      where you can find how to start and stop a service

      Need programmers to hire?
      www.labcsp.com
      www.denisgottardello.it
      GMT+1
      Skype: mrdebug

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved