Location Tracking with React Native
Article Summary
Yusuf Zeren from Trendyol reveals how they solved real-time courier tracking in React Native—a challenge that seems impossible when JavaScript stops running in the background.
Trendyol's fast delivery team needed to track couriers continuously to assign orders to the nearest driver. The solution required native code since JavaScript won't run when apps are backgrounded or closed. After testing free options, they landed on transistorsoft's background geolocation library with surprising results on both iOS and Android.
Key Takeaways
- Switched from location-based to time-based tracking: updates every minute when stationary
- iOS 13+ blocks background permission popups, requiring manual settings redirect
- Power saving modes kill tracking, so they monitor battery status constantly
- Android uses Headless Tasks; iOS wakes app in background after 100-200m movement
- Library costs money on Android but one license works for staging and production
Real-time location tracking in React Native requires native solutions and careful handling of OS-level permission changes, power modes, and platform differences between iOS and Android.
About This Article
Trendyol's courier tracking system used location-based triggers at first, but this approach had a problem. Couriers needed real-time position updates even when they weren't moving, so the company could assign orders accurately and coordinate deliveries properly.
Yusuf Zeren's team switched to time-based tracking instead. They used transistorsoft's react-native-background-geolocation library to send location data every 60 seconds when couriers were idle, and more frequently when they were moving.
The new system worked on both iOS and Android, enabling continuous background tracking without issues. The tradeoff is that time-based tracking drains the battery faster than distance-based alternatives.