Mobile App for City Navigation
A navigation app is one of the most technically saturated types of mobile products. GPS, map data, routing algorithms, TTS, and real-time traffic converge here. Building a navigation engine from scratch makes no sense — but correctly integrating ready-made SDKs and building user experience is a serious separate task.
Choosing a Cartographic Platform
First architectural decision — which SDK to use. This determines cost, capabilities, and limitations for years ahead.
| Platform | Routing | Traffic | Offline | Custom Style | Cost |
|---|---|---|---|---|---|
| Google Maps SDK + Navigation SDK | Excellent | Yes (real-time) | No | Limited | High at volume |
| Mapbox | Excellent | Via Isochrone API | Yes (OfflineManager) | Full freedom | Medium |
| HERE Maps | Good | Yes | Yes | Medium | Medium |
| 2GIS | Good for CIS | Limited | Yes | Limited | Low for CIS |
| OpenStreetMap + OSRM | Open Source | No | Depends on hosting | Full | Server costs |
Google Navigation SDK gives best turn-by-turn experience out of box, but license forbids displaying competing services next to map. Mapbox — maximum flexibility, offline maps, custom styles via Mapbox Studio.
GPS and Real-Time Localization
CLLocationManager / FusedLocationProviderClient — basic GPS. For navigation important:
-
desiredAccuracy: kCLLocationAccuracyBestForNavigation(iOS) — maximum accuracy, high power consumption -
distanceFilter: 5meters — update on each significant movement - Background operation:
locationbackground mode +allowsBackgroundLocationUpdates = true
Map matching — snap GPS points to road network. Raw GPS jumps 10-30 meters, especially between buildings. Mapbox Map Matching API takes coordinates and returns track snapped to roads. Without this, car "drives through buildings" on map.
For pedestrian navigation, map matching matters less — pedestrian can go anywhere, strict road snapping interferes.
Movement Direction Detection
Compass heading (CLHeading / SensorManager.getDefaultSensor(TYPE_ROTATION_VECTOR)) — for pedestrian. Orientation of velocity vector — for car navigation: direction from last two GPS points, not compass (more accurate when moving). Below 5 km/h speed — switch back to compass.
Map rotation by movement direction: GMSCameraUpdate.setTarget(_:bearing:) (Google) or MapboxMap.setCamera(CameraOptions(bearing:)). Smooth rotation via animation with CATransaction / animated camera update.
Turn-by-Turn and Voice Prompts
Ready SDKs (Mapbox Navigation SDK, Google Navigation SDK) provide NavigationViewController / MapboxNavigationView — full navigation UI. Customization: colors, icons, hide/show elements via configuration objects.
For voice prompts: Mapbox Navigation SDK uses SpeechSynthesizer with replacement capability for Amazon Polly or custom TTS. Google Navigation SDK — built-in TTS without direct access. AVSpeechSynthesizer (iOS) / Android TextToSpeech if building prompts yourself.
Very important: interrupt playing audio (music, podcast) during prompt. AVAudioSession.sharedInstance().setCategory(.playback, options: .duckOthers) on iOS — reduces other audio volume, doesn't stop. AudioFocusRequest.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK on Android — equivalent.
Route Recalculation and Alternative Routes
Deviation from route → recalculate. Mapbox Navigation SDK does this automatically on deviation beyond RouteOptions.maximumAllowedDivergence (default 20 meters from route). Recalculation takes 0.5-2 seconds, navigation continues on old route during that.
Alternative routes on start: Google Directions API and Mapbox Directions API return up to 3 alternatives. Display on map as thin lines, tap to switch.
Traffic Consideration and ETA
Real-time arrival with traffic — via Directions API with departing_now. Update ETA every 30-60 seconds on road condition change. If expected arrival time increased significantly — auto-recalculate route or suggest to user.
Offline Navigation
Mapbox OfflineManager — download region tiles. Offline routing — OSRM or Valhalla deployed on server, cached routes. For full offline on device — GraphHopper Embedded (Java), Android integration via JNI or mobile graph file (~100-500 MB for country).
Phases: cartographic platform choice → GPS and map matching → navigation engine → voice prompts → offline → testing on real routes → release.
Timeline: 10 to 20 weeks. Cost calculated individually.







