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. Restart application and connect to already running Android service
Forum Updated to NodeBB v4.3 + New Features

Restart application and connect to already running Android service

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 352 Views 1 Watching
  • 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.
  • V Offline
    V Offline
    vlada
    wrote on last edited by vlada
    #1

    Hi,

    I have 2 questions regarding Android service. I created one for my application using this guide. It works fine so fast. But after (I do believe) upgrade to Qt 5.11, I get a Semantic Issue warning on this command:

    QAndroidJniObject::callStaticMethod<void>("com/kdab/training/MyService",
                                                  "startMyService",
                                                  "(Landroid/content/Context;)V",
                                                  QtAndroid::androidActivity().object());
    

    After starting the service I use RemoteObjects to connect the service and my application. The code to do it looks like this:

    repNode = new QRemoteObjectNode(this);
    repNode->connectToNode(QUrl(QStringLiteral("local:replica")));
    service = repNode->acquire<MyServiceReplica>();
    bool res = service->waitForSource();
    if (res) {
       service->registerRecievers();
    }
    

    It works fine if the service is not running. But what should I do if the service is already running, my application closes and then I start it again? I don't want to restart the service but only connect it with my application.

    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