UNPKG

react-native-android-background-geolocation

Version:

A react-native geolocation module for Android, which can run in the foreground and background even the app is terminated.

28 lines (27 loc) 973 B
Object.defineProperty(exports,"__esModule",{value:true});exports.Impl=undefined; var _reactNative=require('react-native'); require('./type'); var geolocationService=_reactNative.NativeModules.GeolocationService; var Impl=exports.Impl={ start:function start(option){ geolocationService.start(option); }, stop:function stop(){ geolocationService.stop(); }, onLocationChanged:function onLocationChanged(listener){ _reactNative.DeviceEventEmitter.addListener('onLocationChanged',listener); return function(){ _reactNative.DeviceEventEmitter.removeListener('onLocationChanged',listener); }; }, onError:function onError(listener){ _reactNative.DeviceEventEmitter.addListener('onError',listener); return function(){ _reactNative.DeviceEventEmitter.removeListener('onError',listener); }; }, removeAllListeners:function removeAllListeners(){ _reactNative.DeviceEventEmitter.removeAllListeners('onLocationChanged'); _reactNative.DeviceEventEmitter.removeAllListeners('onError'); }};