Fast native geolocation plugin for Capacitor that returns city, state, and country using on-device reverse geocoding.
- ✅ Fast native geolocation
- 🌍 Reverse geocoding (City, State, Country)
- ⚡ Works offline with on-device services (no external APIs)
npm install @yaseenalmufti/fast-geolocation
npx cap sync| Platform | Supported |
|---|---|
| Android | ✅ |
| iOS | ✅ |
| Web | ❌ |
import { FastGeolocation } from '@yaseenalmufti/fast-geolocation';
const getLocation = async () => {
try {
const location = await FastGeolocation.getCurrentCity();
console.log(\`You are in \${location.city}, \${location.state}, \${location.country}\`);
} catch (error) {
console.error('Error getting location:', error);
}
};Returns the current GPS location and reverse-geocoded city, state, and country.
interface CityLocation {
latitude: number;
longitude: number;
city: string;
state: string;
country: string;
}In android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />The plugin uses:
FusedLocationProviderClientfor fast location accessGeocoderfor native reverse geocoding
In ios/App/App/Info.plist:
<key>NSLocationWhenInUseUsageDescription</key>
<string>We need your location to determine your city</string>The plugin uses:
CLLocationManagerfor GPS accessCLGeocoderfor native reverse geocoding
Yaseen Almufti
- GitHub: @yaseenalmufti
- npm: @yaseenalmufti
MIT