Search code examples
androidcordovageolocation

How often should I track device position in Ionic 2 (e.g. Uber, Taxi Apps, ...)


I am studying the Cordova geolocation plugin for Ionic 2 and want to send the device location to my server when the app is opened.

To keep track of the route of the device I want to send the position all the time to the server. I was wondering how often I should do this. Every time the location changes seems a little too often!?

How do other tracking apps do this?


Solution

  • Granularity of position updates are inversely proportional to the battery power consumed and the network bandwidth used for transmitting the positional information.

    I use the following guidelines:

    1. Transmit position whenever the position has exceeded a defined distance 'D'
    2. Transmit position whenever a defined period of time 'T' has elapsed since the last successful transmission
    3. Transmit position when the app starts
    4. Disable transmission when the activity is paused and enable it when the activity is resumed
    5. Always save the last successful transmission (position and time stamp) for future reference

    I typically store the defined parameters 'D' and 'T' in a configuration file, making it handy to test how the application performs for different values.

    Using coarse GPS for reference, position accuracy is rarely better than 15 meters (without applying GPS corrections). With that in mind, you can set your 'D' value to something between 15-30 meters. If you are tracking vehicles, that distance can be exceeded pretty quickly, in which case a larger value may be preferable to avoid sending too much data.

    You can also increase 'D' as a function of your positional velocity (speed). this would increase 'D' the faster the vehicle is moving, thus maintaining a consistent bandwidth usage.

    The value of 'T' really depends on your application needs. If a vehicle is sitting idle, then I typically transmit updates once every 5 minutes.

    I have used distances ('D') between 30-100 meters. If you are monitoring vehicle positions in an urban environment, you need to be able to pin point where that vehicle is within a crowded street plan. This becomes quite clear if you've ever used a GPS device to navigate in an older city, where the device often gets confused between streets that are in close proximity (i.e., New York, Boston, Montreal, etc.) In this case, a smaller value (> 15m) is preferable.

    For added robustness, you might want to add some heuristics into your application. For example, popular after-market GPS devices for automobiles have to implement more intelligence into their applications, in order to snap the vehicle position to a location on a street or road. Otherwise, the vehicle would never show up on the street itself, but rather somewhere in the ditch, or right in the middle of a building on the map.

    One example of such heuristics would be to assume that unless the vehicle has reached an intersection, it is still on the same street that was reported previously.

    Ultimately, you need to try out different configurations in order to find what best suits your needs.