简体   繁体   中英

iOS GPS track users location realtime

I'm building an iOS app that needs access to the location of the two users: driver and passenger. This app will be quite similar to Uber app where the passenger requests for a driver nearby to pick him up and eventually track the location of the driver real time. I'm new with location based app, so I would like to ask for best approach to do this. So here's my algorithm so far:

  1. Passenger app requests for driver by sending his current location to the server
  2. Server queries the nearest driver and sends push notification message to the selected driver
  3. Driver receives the push notification message and sends confirmation back to the server
  4. Server sends the details to the passenger
  5. Driver starts sending his location to the server (every 10secs) thru REST API request
  6. Server sends the drivers location to the passenger thru push notification

Thanks

I think send data through push is bad idea (use webscoket for example or request to server to REST).

1) Use CLLocationManager to get current position example, very easy

2) Use APNs to push or use firebase to easy send push

3) Just use REST

4) Just REST

5) Use CLLocationManager and by timer send current driver location. Use example from first paragraph

6) Use websocket or request to update info about driver location

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM