Real-time geolocation tracking in mobile app

NOVASOLUTIONS.TECHNOLOGY is engaged in the development, support and maintenance of iOS, Android, PWA mobile applications. We have extensive experience and expertise in publishing mobile applications in popular markets like Google Play, App Store, Amazon, AppGallery and others.
Development and support of all types of mobile applications:
Information and entertainment mobile applications
News apps, games, reference guides, online catalogs, weather apps, fitness and health apps, travel apps, educational apps, social networks and messengers, quizzes, blogs and podcasts, forums, aggregators
E-commerce mobile applications
Online stores, B2B apps, marketplaces, online exchanges, cashback services, exchanges, dropshipping platforms, loyalty programs, food and goods delivery, payment systems.
Business process management mobile applications
CRM systems, ERP systems, project management, sales team tools, financial management, production management, logistics and delivery management, HR management, data monitoring systems
Electronic services mobile applications
Classified ads platforms, online schools, online cinemas, electronic service platforms, cashback platforms, video hosting, thematic portals, online booking and scheduling platforms, online trading platforms

These are just some of the types of mobile applications we work with, and each of them may have its own specific features and functionality, tailored to the specific needs and goals of the client.

Showing 1 of 1 servicesAll 1735 services
Real-time geolocation tracking in mobile app
Medium
~2-3 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_mobile-applications_feedme_467_0.webp
    Development of a mobile application for FEEDME
    756
  • image_mobile-applications_xoomer_471_0.webp
    Development of a mobile application for XOOMER
    624
  • image_mobile-applications_rhl_428_0.webp
    Development of a mobile application for RHL
    1052
  • image_mobile-applications_zippy_411_0.webp
    Development of a mobile application for ZIPPY
    947
  • image_mobile-applications_affhome_429_0.webp
    Development of a mobile application for Affhome
    862
  • image_mobile-applications_flavors_409_0.webp
    Development of a mobile application for the FLAVORS company
    445

Implementation of Real-Time Geolocation Tracking

Showing a user's location point on a map — five lines of code. Transmitting it to the server every 5 seconds with minimal battery drain while the app is in the background, correctly handling signal loss and reconnection — that's a completely different story.

Where Problems Usually Arise

The most common mistake is not separating foreground and background tracking. In foreground, you can run CLLocationManager with desiredAccuracy: .bestForNavigation and distanceFilter: 5 — the user is actively watching the map, battery is not a priority. In background, the same mode will kill the charge in two hours and cause complaints.

On Android the problem is acute: since version 8.0, the system aggressively kills background processes. LocationManager.requestLocationUpdates() from Service without startForeground() stops receiving updates within a few minutes on most firmware. MIUI and One UI with "Battery Optimization" settings make this even faster — regardless of developer settings.

Stack and Architecture

iOS

For foreground — CLLocationManager with CLLocationAccuracy.best, callback in didUpdateLocations. For background — allowsBackgroundLocationUpdates = true + "Background Modes → Location updates" capability in entitlements. Without this flag, background updates simply don't arrive, and no error appears in the console.

Buffer coordinates locally (array in memory or Core Data) and send in batches via URLSession.shared.uploadTask every N seconds or upon accumulating K points. Single HTTP requests for each update is an anti-pattern: with poor internet, the queue grows faster than it's consumed.

To save battery, switch mode depending on context:

  • App active: desiredAccuracy = kCLLocationAccuracyBest, distanceFilter = 10
  • Screen off: desiredAccuracy = kCLLocationAccuracyHundredMeters, distanceFilter = 50
  • Long tracking: Significant Location Changes API instead of continuous monitoring

Android

FusedLocationProviderClient from play-services-location is the only right choice for most projects. Platform LocationManager gives less control over source fusion.

val request = LocationRequest.Builder(Priority.PRIORITY_HIGH_ACCURACY, 5_000L)
    .setMinUpdateDistanceMeters(10f)
    .setWaitForAccurateLocation(false)
    .build()

fusedLocationClient.requestLocationUpdates(
    request,
    locationCallback,
    Looper.getMainLooper()
)

Background tracking — only via Foreground Service with notification. Notification can't be hidden per Android 9+ requirements. Register service via startForeground() with FOREGROUND_SERVICE_TYPE_LOCATION (Android 10+).

On connection loss — Room as local buffer. WorkManager with Constraints.Builder().setRequiredNetworkType(NetworkType.CONNECTED) sends accumulated points when connection restores.

Flutter

geolocator package for getting positions, background_locator_2 or flutter_background_geolocation (paid but reliable) for background mode. Send coordinates via Isolate or FlutterEngine background service to Dart layer, save to Isar or sqflite, sync via Dio with retry logic.

Real-Time Server Transmission

If you need to show position to other users in real time — HTTP polling doesn't work. WebSocket (socket.io or native URLSessionWebSocketTask / OkHttp WebSocket) or MQTT (lighter traffic, better for unstable connection). For Flutter — mqtt_client package.

MQTT topic like tracking/{userId}/location, QoS 1 for delivery guarantee without read confirmation. Server (Node.js + mosquitto broker or AWS IoT Core) distributes updates to subscribers.

Workflow

Planning: tracking modes, intervals, buffering, transmission protocol. iOS and/or Android implementation with correct service lifecycle. Server side implementation for receiving coordinates (if needed). Testing on real trips, checking behavior when switching network/no network.

Timeline: three to eight days depending on platforms, presence of server part, and real-time display requirements.