📍 react-native-shbib-geolocation
A high-accuracy React Native geolocation library using Android's FusedLocationProviderClient (FLPC). Professional-grade location services with real-time tracking, comprehensive permission management, and configurable accuracy levels.

✨ Features
- 🎯 High-Accuracy Location - FusedLocationProviderClient for precise GPS tracking
- 📍 Real-time Tracking - Continuous location monitoring with configurable intervals
- 🔐 Permission Management - Built-in location permission request and status checking
- ⚙️ Configurable Accuracy - Multiple accuracy levels for battery optimization
- 🛡️ Error Handling - Comprehensive error reporting with fallback strategies
- 📦 Auto-linking - Seamless React Native integration
- 🎯 TypeScript Support - Complete type definitions
📦 Installation
npm install react-native-shbib-geolocation
yarn add react-native-shbib-geolocation
Add permissions to android/app/src/main/AndroidManifest.xml:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
🚀 Quick Start
import geoLocation from "react-native-shbib-geolocation";
geoLocation.getCurrentLocation(
(location, error) => {
if (error) {
console.error("Location error:", error.message);
return;
}
console.log(`Location: ${location.latitude}, ${location.longitude}`);
console.log(`Accuracy: ${location.accuracy}m`);
},
{ accuracy: "high", timeout: 15000 }
);
const watchId = geoLocation.watchLocation(
(location, error) => {
if (error) return;
updateMapPosition(location);
},
{
accuracy: "high",
interval: 5000,
distanceFilter: 10
}
);
geoLocation.stopWatchingLocation(watchId);
📚 API Reference
Core Methods
getCurrentLocation(callback, options) - Get single location
watchLocation(callback, options) - Continuous monitoring
stopWatchingLocation(watchId) - Stop location watch
Permission Methods
hasLocationPermission() - Check permission status
requestLocationPermission() - Request permissions
isLocationServicesEnabled() - Check location services
Accuracy Levels
high | GPS + Network | High | Navigation |
balanced | Network + GPS | Medium | General apps |
low | Network only | Low | Weather |
passive | Other apps only | Very Low | Background |
🎯 Use Cases
Navigation Apps - High-frequency, precise tracking
Fitness Apps - Route tracking with good accuracy
Delivery Apps - Vehicle tracking with moderate updates
Social Apps - Current location for check-ins
🚨 Error Handling
geoLocation.getCurrentLocation(
(location, error) => {
if (error) {
switch (error.code) {
case "PERMISSION_DENIED":
break;
case "LOCATION_UNAVAILABLE":
break;
case "TIMEOUT":
break;
}
return;
}
},
options
);
📄 License
MIT License - see LICENSE file for details.
📞 Support
Made with ❤️ by Amr Shbib