Service or Daemon for getting location of my device?

  • Hi,

    I am trying to write an application which tells the GPS location of the device. What I want is: once I install my application, the device should send the location to a server at a specific time interval even when the application is NOT running. How do I achieve it?

    Should I use a service or write a daemon for this small task? Also if there is any example of such kind of requirement?


  • You don't mention what type of device and what version of Qt you are using.

    Write a console application that gets the GPS location of the device, you can use Qt Location for this, and send the location to the server. Either have the application run continuously or arrange for it to be started periodically (e.g. using by using cron).

  • Your basic question is just impossible: you cannot make a random OS send the devices location to a server without having your application running. You either have code running (a service, a deamon, something started periodically, whatever) that sends the location, or you don't have code running and nothing is send. That might mean you will need to split off that functionality into its own, and let the user-visible part of your application just connect to this split off part when needed.

  • Hi,

    Thanks for your reply. Yes I know the OS cant send the signals, thats why I asked whether I should make a daemon or service. So my requirement is like this:

    1. User installs the application
    2. User closes the application.

    Now still the application/daemon/service can send the server its device co-ordinates.

    I fetched my location using QLocation. Just I want to send it to the server, even when the application is not running. So what more should I do? Shall I create a daemon/service?

  • And both responses said, yes you do need to write a daemon or service.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.