JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 11
  • Score
    100M100P100Q33849F
  • License MIT

This is a React Native Android library to get the accurate updated location along with satellite count

Package Exports

  • react-native-location-satellites

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-native-location-satellites) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-native-location-satellites

Getting started

$ npm install react-native-location-satellites --save

Supports only Android. Due to security issues iOS will not disclose satellite counts.

Mostly automatic installation

$ react-native link react-native-location-satellites

Manual installation

Android

  1. Append the following lines to android/settings.gradle:
    include ':react-native-location-satellites'
    project(':react-native-location-satellites').projectDir = new File(rootProject.projectDir, 	'../node_modules/react-native-location-satellites/android')
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
    compile project(':react-native-location-satellites')
  3. Append the following lines in MainApplication.java
    import com.synclovis.RNLocationSatellitesPackage;
    protected List<ReactPackage> getPackages() {
            return Arrays.<ReactPackage>asList(                 
                    new RNLocationSatellitesPackage()
            );
    }

Usage

Make sure that you have accessed right permissions for getting location.

This library will give you the following location details,

  1. latitude & longitude
  2. accuracy
  3. speed
  4. altitude
  5. bearing
  6. satellites
import {NativeEventEmitter} from 'react-native';
import {RNLocationSatellites} from 'react-native-location-satellites';
const GPSEventEmitter = new NativeEventEmitter(RNLocationSatellites)
componentDidMount(){
    console.log(RNLocationSatellites)
    RNLocationSatellites.startLocationUpdate();
    
    GPSEventEmitter.addListener('RNSatellite', (event) => {
      alert(JSON.stringify(event))
       })
    
    RNLocationSatellites.getLastKnownLocation('EVENT_NAME');

    GPSEventEmitter.addListener('EVENT_NAME', (event) => {
      alert(JSON.stringify(event))
       })
}

componentWillUnmount(){
    GPSEventEmitter.removeListener('RNSatellite')
    GPSEventEmitter.removeListener('EVENT_NAME')
}