# react-native-geolocation-helper

> helpers for android geolocation and high accuracy detection

Latest version **1.0.2** (published 2019-07-09) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install react-native-geolocation-helper
pnpm add react-native-geolocation-helper
yarn add react-native-geolocation-helper
bun add react-native-geolocation-helper
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2019-07-09 |
| First published | 2019-05-05 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 82.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Cladjules |
| Maintainers | cladjules |
| Keywords | react-native, geolocation, android, location, accuracy |

## Links

- npm: https://www.npmjs.com/package/react-native-geolocation-helper
- Repository: https://github.com/cladjules/react-native-geolocation-helper
- Homepage: https://github.com/cladjules/react-native-geolocation-helper#readme
- Issues: https://github.com/cladjules/react-native-geolocation-helper/issues
- npm.io page: https://npm.io/package/react-native-geolocation-helper

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.2 (latest) — 2019-07-09
- 1.0.1 — 2019-05-05
- 1.0.0 — 2019-05-05

## README

# react-native-geolocation-helper
Geolocation Helpers for React Native
Currently only works on Android, there are 2 methods:
- Retrieve device's location mode
- Prompt an `Enable high accuracy` modal to the user.

# Installation
```bash
npm i react-native-geolocation-helper
react-native link react-native-geolocation-helper
```

# Compatibility
| RN Version | Package Version |
| ---------- | --------------- |
| 0.57+      | 1.0.0           |
| <0.57      | Not tested      |

## Usage

```js
import GeolocationHelper, { LocationMode } from 'react-native-geolocation-helper';

GeolocationHelper.requestLocationSettings({ title: 'Your title', message: 'Your message' })
  .then(() => // User has accepted modal or high accuracy is already enabled })
  .catch(() => // User has canceled high accuracy modal });

GeolocationHelper.getLocationMode().then(locationMode => {
  // locationMode === LocationMode.HIGH_ACCURACY
  // locationMode === LocationMode.SENSORS_ONLY
  // locationMode === LocationMode.BATTERY_SAVING
  // locationMode === LocationMode.OFF
});
```

# API
#### `requestLocationSettings(?title, ?message)`
Display a modal to prompt the user to enable High accuracy,
redirects the user to the Location Settings Page `ACTION_LOCATION_SOURCE_SETTINGS` when clicking `OK`.
- **resolve**: resolve if highAccuracy is enabled or users clicks OK on the modal.
- **reject**: reject if highAccuracy not enabled and users clicks Cancel on the modal.

| Param | Default |
| -- | -- |
| title | `Enable High Accuracy`|
| message | `Choose High Accuracy as the Location method`|

#### `getLocationMode()`
Return the current location mode enabled on the device.
- **resolve**: return a value from `LocationMode`

| LocationMode |
| -- |
| HIGH_ACCURACY |
| SENSORS_ONLY |
| BATTERY_SAVING |
| OFF |

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