Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-location-satellites

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-location-satellites

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

  • 1.0.4
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-native-location-satellites

Getting started

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

NOTE: 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(){
    /**
	 * Starts location update 
	 */
	RNLocationSatellites.startLocationUpdate();
	
	/**
	 * Event for getting location. 
	 */
    GPSEventEmitter.addListener('RNSatellite', (event) => {
      alert(JSON.stringify(event))
   	})
	
	/**
	 * Returns the last known location (GPS)
	 */
	RNLocationSatellites.getLastKnownLocation().then((location)=>{
      console.log("Last known location: ",location)
    })
}

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

Keywords

FAQs

Package last updated on 08 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc