New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

react-native-shbib-geolocation

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

react-native-shbib-geolocation

High-accuracy geolocation library using FusedLocationProviderClient for React Native

latest
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

📍 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.

npm version License: MIT Platform

✨ 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
# or  
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";

// Get current location
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 }
);

// Watch location continuously  
const watchId = geoLocation.watchLocation(
  (location, error) => {
    if (error) return;
    updateMapPosition(location);
  },
  {
    accuracy: "high",
    interval: 5000, // 5 seconds
    distanceFilter: 10 // 10 meters
  }
);

// Stop watching
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

LevelDescriptionBatteryUse Case
highGPS + NetworkHighNavigation
balancedNetwork + GPSMediumGeneral apps
lowNetwork onlyLowWeather
passiveOther apps onlyVery LowBackground

🎯 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":
          // Request permissions
          break;
        case "LOCATION_UNAVAILABLE": 
          // Check location services
          break;
        case "TIMEOUT":
          // Increase timeout or lower accuracy
          break;
      }
      return;
    }
    // Handle location
  },
  options
);

📄 License

MIT License - see LICENSE file for details.

📞 Support

Made with ❤️ by Amr Shbib

Keywords

react-native

FAQs

Package last updated on 28 Aug 2025

Related posts