# react-native-location-satellites

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

Latest version **1.0.5** (published 2019-11-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-native-location-satellites
pnpm add react-native-location-satellites
yarn add react-native-location-satellites
bun add react-native-location-satellites
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2019-11-12 |
| First published | 2019-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 146.9 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Anooj Krishnan G |
| Maintainers | anoojkrishnan |
| Keywords | react-native, react-native-location-satellites, react-native-location, react-location, react-native-accurate-location, npm location, satellite, react-native-satellites, react-satellite, rn-satellite-count, rn-satellites, rn-location-satellites |

## Links

- npm: https://www.npmjs.com/package/react-native-location-satellites
- Repository: https://github.com/anooj1483/react-native-location-satellites
- Homepage: https://github.com/anooj1483/react-native-location-satellites#readme
- Issues: https://github.com/anooj1483/react-native-location-satellites/issues
- npm.io page: https://npm.io/package/react-native-location-satellites

## Recent versions

- 1.0.5 (latest) — 2019-11-12
- 1.0.4 — 2019-11-08
- 1.0.4-beta-4 — 2019-11-08
- 1.0.4-beta-3 — 2019-11-08
- 1.0.4-beta-2 — 2019-11-08
- 1.0.4-beta-1 — 2019-11-08
- 1.0.3 — 2019-11-08
- 1.0.2 — 2019-11-07
- 1.0.1 — 2019-11-07
- 1.0.0 — 2019-11-07

## README

# react-native-location-satellites

<img src="https://github.com/anooj1483/react-native-location-satellites/blob/master/example/logo.png?raw=true" data-canonical-src="https://github.com/anooj1483/react-native-location-satellites/blob/master/example/logo.png?raw=true" width="130" height="130" />

## Getting started

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

### NOTE: Due to security issues iOS will not disclose satellite counts.
### iOS library will give you location details except satellite count

### 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()
            );
    }
	```

### iOS

1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`
2. Go to `node_modules` ➜ `react-native-location-satellites` and add `RNLocationSatellites.xcodeproj`
3. In XCode, in the project navigator, select your project. Add `libRNLocationSatellites.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`
4. Run your project (`Cmd+R`)<

### Using Cocoapods

1. In Terminal, from your root folder, `cd iOS`
2. Open PodFile, add the following,
	```
	 pod 'react-native-location-satellites', :path => '../node_modules/react-native-location-satellites'
	 ```
3. Run `pod install`


## 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


```javascript
import {NativeEventEmitter} from 'react-native';
import {RNLocationSatellites} from 'react-native-location-satellites';
const GPSEventEmitter = new NativeEventEmitter(RNLocationSatellites)
componentDidMount(){

	/**
	 * iOS Only - Request location permission (iOS 13 Support)
	 */
	RNLocationSatellites.requestAlwaysAuthorization()
		
	/**
	 * Event for getting location. 
	 */
    GPSEventEmitter.addListener('RNSatellite', (event) => {
      console.log(event);      
   	})
	
	/**
	 * Starts location update 
	 */
   	RNLocationSatellites.startLocationUpdate()
    

	
	/**
	 * Android Only - Returns the last known location (GPS)
	 */
	RNLocationSatellites.getLastKnownLocation().then((location)=>{
      console.log("Last known location: ",location)
    })
}

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

```

---
_Source: https://npm.io/package/react-native-location-satellites · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
