0.1.10 • Published 7 months ago

react-native-mo-geolocation v0.1.10

Weekly downloads
8
License
MIT
Repository
github
Last release
7 months ago

react-native-mo-geolocation

Geolocation and Background-Geolocation API

Installation

Install just like your ordinary react-native module.

Usage

Please check the example/ code.

import { Geolocation, GeolocationAccuracy, GeolocationPermissionStatus } from 'react-native-mo-geolocation';

if (await Geolocation.requestPermissions({ background: true }) === GeolocationPermissionStatus.DENIED) {
  Geolocation.showSettings();
}

const location = await Geolocation.get({ accuracy: GeolocationAccuracy.BEST });

const sub = Geolocation.observe({
  background: true,
  indicateBackground: true,
  accuracy: GeolocationAccuracy.BEST,
}).subscribe((pos) => {
  if (pos instanceof Error) {
    console.log('we had an error!');
  } else {
    console.log('new position', pos);
  }
});
// ...
sub.remove();

Notes

  • If you are using Android background mode, a background service will run showing a permanent notification. Use mipmaps/ic_background to change the icon. The text and behaviour is otherwise not customizable by android.

  • For iOS you need to pass indicateBackground: true to prevent the app from getting terminated.

0.1.10

7 months ago

0.1.9

2 years ago

0.1.8

4 years ago

0.1.7

5 years ago

0.1.6

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago