Skip to main content

cordova-plugin-nativegeocoder Alternative for Capacitor

cordova-plugin-nativegeocoder alternative for Capacitor: forward and reverse geocode with native iOS and Android APIs via @capgo/capacitor-nativegeocoder.

Illustration of migrating a Cordova app to Capacitor, used for a native geocoder guide

The cordova-plugin-nativegeocoder alternative for Capacitor is @capgo/capacitor-nativegeocoder. It keeps the same promise as the Cordova plugin: geocode on device through Core Location on iOS and Android Geocoder, without routing every lookup through a paid HTTP geocoding bill. Replace callback-style nativegeocoder.reverseGeocode with NativeGeocoder.reverseGeocode() and use the same option names where they overlap.

Why leave cordova-plugin-nativegeocoder

cordova-plugin-nativegeocoder is at 3.5.1 on npm with modified 8 March 2023. The source repository is sebastianbaar/cordova-plugin-nativegeocoder. The README still documents cordova plugin add cordova-plugin-nativegeocoder and callback signatures with separate latitude and longitude arguments.

Capacitor migrations hit friction because:

  • The global nativegeocoder object is Cordova-specific.
  • Success handlers return field names like administrativeArea and addressLines that your TypeScript models must mirror manually.
  • The plugin does not ship as a Capacitor package on npm.

@capgo/capacitor-nativegeocoder targets Capacitor 8 in the maintained v8 line. It adds a web implementation that calls the Google Geocoding API when you supply apiKey, while iOS and Android stay on the OS geocoder. Capgo fixes ship in the public repo where a human still reviews, tests and merges 50+ pull requests daily.

Install

bun add @capgo/capacitor-nativegeocoder
bunx cap sync

Android (android/app/src/main/AndroidManifest.xml):

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-feature android:name="android.hardware.location.gps" />

iOS: set NSLocationWhenInUseUsageDescription in Info.plist (and the always string if your flow requires it). iOS geocoding needs network access even though coordinates come from the native APIs.

Usage example

import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder';

export async function lookupAddress(lat: number, lng: number) {
  const { addresses } = await NativeGeocoder.reverseGeocode({
    latitude: lat,
    longitude: lng,
    useLocale: true,
    maxResults: 1,
  });

  return addresses[0]?.locality;
}

Forward geocode before opening maps navigation:

const { addresses } = await NativeGeocoder.forwardGeocode({
  addressString: '1 Infinite Loop, Cupertino, CA',
  maxResults: 1,
});
const { latitude, longitude } = addresses[0];

Pair with @capgo/capacitor-launch-navigator which expects coordinate pairs, not free-form addresses.

Migrating from Cordova to Capacitor

Drop nativegeocoder.* callbacks. Pass one options object per call and read addresses from the resolved promise.

API mapping table

cordova-plugin-nativegeocoder @capgo/capacitor-nativegeocoder
nativegeocoder.reverseGeocode(success, error, lat, lng, options) reverseGeocode({ latitude, longitude, useLocale?, defaultLocale?, maxResults? })
nativegeocoder.forwardGeocode(success, error, addressString, options) forwardGeocode({ addressString, useLocale?, defaultLocale?, maxResults? })
Success Array<Result> Promise { addresses: [...] }
Result latitude / longitude strings Same fields on address objects
administrativeArea, locality, postalCode, … Same placemark style fields in results
addressLines (Android) Preserved on Android results per native formatter
options.useLocale useLocale: boolean
options.defaultLocale defaultLocale: string
options.maxResults (1 to 5) maxResults (1 to 5)
Cordova install + global import { NativeGeocoder } from '@capgo/capacitor-nativegeocoder'

Read the Cordova Known Issues section when you debug locale-specific formatting. Capgo returns the same underlying platform data.

Permission changes require a native build via Capgo Build. Geocoding UI logic can ship faster with live updates. Full Cordova exit path: migrating Cordova to Capacitor.

Live updates for Capacitor apps

When a web-layer bug is live, ship the fix through Capgo instead of waiting days for app store approval. Users get the update in the background while native changes stay in the normal review path.

Latest from our Blog

Capgo gives you the best insights you need to create a truly professional mobile app.