Mobile Development 9 min read

Common Pitfalls and Solutions for Location and Map Integration in iOS and Android Apps

The article examines typical coordinate‑system and accuracy problems encountered when implementing location and map features on iOS and Android, explains why they occur, and shares Ctrip's practical solutions including coordinate conversion, Wi‑Fi handling, and WebView‑based map rendering.

Ctrip Technology
Ctrip Technology
Ctrip Technology
Common Pitfalls and Solutions for Location and Map Integration in iOS and Android Apps

Author Bio: Chen Haoran, Ctrip Wireless Development Director, Ph.D. in Computer Science, has been involved in mobile Internet since the 2008 iOS SDK release, participating in enterprise‑grade, independent, and hundred‑million‑user apps.

This article shares the common pitfalls encountered in iOS/Android location and map functionalities and Ctrip's solutions.

Location

Location means obtaining the user's current latitude and longitude. On iOS, all apps use the system SDK, so positioning capability is identical across apps. On Android, because Google Services are often unavailable in China, third‑party SDKs such as Gaode or Baidu are used, leading to differences in capability and precision.

1. Coordinate‑System Issue

Three coordinate systems are in use: WGS‑84 (global), GCJ‑02 (China’s “Mars” standard), and BD‑09 (Baidu). The map must use the same system as the coordinate data, otherwise points appear offset and distance‑based sorting becomes incorrect.

iOS returns WGS‑84 via CLLocation . Domestic iOS maps use Gaode data (GCJ‑02), so raw WGS‑84 points appear shifted. Ctrip offsets coordinates locally using a transformation algorithm instead of integrating a third‑party SDK.

Android apps typically obtain coordinates from Gaode (GCJ‑02 in mainland, WGS‑84 overseas) or Baidu (configurable to WGS‑84, GCJ‑02, or BD‑09). Overseas maps use only WGS‑84.

2. Accuracy Issue

Accuracy varies because phones can use GPS (10‑100 m, poor indoors), cellular towers (1‑3 km, slower), or Wi‑Fi (100‑200 m, dependent on nearby routers). Turning Wi‑Fi off dramatically reduces accuracy, as shown by the comparison images.

In navigation mode, speed and heading data allow the algorithm to snap the position to the road even without Wi‑Fi.

Map

iOS system maps have two data sources: Gaode for mainland China (GCJ‑02) and TomTom for Hong‑Kong, Macau, Taiwan, and overseas (WGS‑84). Consequently, the same POI may be displayed correctly in one region and offset in another.

For Android, Ctrip uses Baidu (similar to Gaode). Overseas Baidu data suffers the same precision loss as iOS Gaode. Ctrip’s workaround is a WebView‑based Google Map (ditu.google.cn) which provides higher‑precision tiles.

The same approach is applied to iOS: when the user is abroad viewing a domestic map (or vice‑versa), the app switches to the custom Google Map; otherwise it uses the native map.

Summary

Location and map issues in Chinese mobile apps stem from the country’s special geodetic standards; Ctrip resolves them through coordinate transformation, Wi‑Fi‑aware accuracy handling, and a fallback WebView Google Map to ensure consistent user experience.

mobile developmentiOSAndroidLocation ServicesMap IntegrationCoordinate Systems
Ctrip Technology
Written by

Ctrip Technology

Official Ctrip Technology account, sharing and discussing growth.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.