react-native-background-geolocation | foreground geolocation plugin for React Native
kandi X-RAY | react-native-background-geolocation Summary
kandi X-RAY | react-native-background-geolocation Summary
React Native fork of cordova-plugin-background-geolocation with battery-saving "circular region monitoring" and "stop detection". This plugin can be used for geolocation when the app is running in the foreground or background.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Runs the configuration
- Creates a Config object from a Map
- Converts a ReadableArray to a JSONArray
- Convert a ReadableMap into a JSONObject
- Get the current locations
- Converts a Location into a WritableMap with the LocationId
- Converts a BackgroundLocation into a WritableMap
- Checks the status of the service
- Gets authorization status
- Deletes a location
- Creates native JavaScript modules
- Called when the application is paused
- Gets the location of this facade
- Asynchronously prints log entries
- Deletes all locations
- Destroys the agent
- Start headless service
- Force sync with success
- Returns the task s task configuration
- Registers a headless task
- Resume the host
- Called when an activity is changed
- Gets the config
- Gets the available locations
- Get the current location
- Send a service status changed event
react-native-background-geolocation Key Features
react-native-background-geolocation Examples and Code Snippets
Community Discussions
Trending Discussions on react-native-background-geolocation
QUESTION
we would like to push local notification after user arrived boundary company. so which library should we use. one more think if user terminate the app, app can push notification when user arrived company.I try to use https://github.com/eddieowens/react-native-boundary and https://github.com/mauron85/react-native-background-geolocation
...ANSWER
Answered 2021-Oct-25 at 23:41You need to use geo-fence for sure.
mauron85/react-native-background-geolocation not have geo-fence feature according to its README file so you can't use the library for this purpose.
I have used transistorsoft/react-native-background-geolocation to make exactly the same thing, it works with no issue, but it's not free.
react-native-boundary is free, but not support. According to open GitHub issues, it has some problems, repo owner not supporting the library for almost 2-3 years. You can still solve a lot of problems with open PRs. I didn't use it, but if you want to go with free, I suggest you examine it.
EDIT: I make it with react-native-boundary
, check below code:
Install dependencies:
QUESTION
Im using React-Native and I have a saga that manages the state of a websocket. It implements re-tries and receives dispatches for things like location change to send it up to the server via websocket. I am using @mauron85/react-native-background-geolocation
to grab location events in the root component of my app and I am dispatching them to redux. The route saga has a spawned generator that listens for this and will send it up. When the app is in foreground(currently in use) the socket can recover from network loss and continue receiving location events however when the app goes to the background as long as the socket is open, the saga responds to the events and can still send them up. As soon as I mark airplane mode and lose the socket, the saga stops responding to retries and other dispatch events such as the location update. When i remove airplane mode (while still in the background) it is not able to re-establish connection and receive dispatches. How can I approach this to be able to allow the app to recover without it ever transitioning back to the foreground.
Saga Code:
...ANSWER
Answered 2021-Jul-14 at 18:03Ended up moving socket logic to the root component of my app and responding to location updates there which allowed me to keep the socket alive in the background and send location updates. E.g
QUESTION
Hello there I'm using @mauron85/react-native-background-geolocation' to get my current coordinates and https://www.npmjs.com/package/geolib library to check if my location is inside a polygon my code is bellow
...ANSWER
Answered 2021-Jun-13 at 20:01apparently this was caused by a null pointer. fixed it with an if else statement.
QUESTION
Using React Native and @mauron85/react-native-background-geolocation, I'm trying to create a function to return true/false depending on whether background geolocation is active or not.
In the documentation, we see an example:
...ANSWER
Answered 2020-Apr-10 at 19:13export async function isBackgroundTracking() {
// Null means undetermined, but should never be returned that way.
var result = null;
// This is accurately logged first.
console.log('One');
// This should finish before moving on.
await new Promise(res => {
BackgroundGeolocation.checkStatus(status => {
result = status.isRunning;
// This is inaccurately logged third.
console.log('Two:', result);
// resolve the promise
res();
});
});
// This is inaccurately logged second.
console.log('Three:', result);
// This is inaccurately returned as null, because `checkStatus` is apparently asynced.
return result;
}
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-native-background-geolocation
Since version 0.60 React Native does linking of modules automatically. However it does it only for single module. As plugin depends on additional 'common' module, it is required to link it with:.
Register the module (in MainApplication.java).
In XCode, in the project navigator, right click Libraries ➜ Add Files to [your project's name]
Add ./node_modules/@mauron85/react-native-background-geolocation/ios/RCTBackgroundGeolocation.xcodeproj
In the XCode project navigator, select your project, select the Build Phases tab and in the Link Binary With Libraries section add libRCTBackgroundGeolocation.a
Add UIBackgroundModes location to Info.plist
Add NSMotionUsageDescription App requires motion tracking to Info.plist (required by ACTIVITY_PROVIDER)
Add NSLocationAlwaysUsageDescription App requires background tracking to Info.plist
Add NSLocationWhenInUseUsageDescription App requires background tracking to Info.plist
Add NSLocationAlwaysAndWhenInUseUsageDescription App requires background tracking to Info.plist
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page