Comments (7)
Is there something special I need to do to get it to work when the app is killed? I can't find any documentation about it
from react-native-boundary.
I am having similar issues when killed. Could it be that the event listeners is bound in such a way that when the app is waked up on geofencing-events that registration of listeners is simply not run (or run after the event is emitted). I have little experience around what code actually gets called when wake up happens in a react-native context. Does anyone know or have a good resource around the topic?
from react-native-boundary.
Hey @ValentinBlokhin, what version of the lib are you using?
from react-native-boundary.
Hey @eddieowens , I've been using 1.1.0
version.
from react-native-boundary.
@ValentinBlokhin Can you post the relevant code block?
from react-native-boundary.
Same here. Everything works perfect on Android and iOS, but if the app is Killed on iOS and some transition is detected, when i open the app it show's this warning:
My code looks exactly like the repository example.
import {NativeEventEmitter, NativeModules, AppRegistry} from 'react-native';
const {RNBoundary} = NativeModules;
const TAG = "RNBoundary";
const boundaryEventEmitter = new NativeEventEmitter(RNBoundary);
const Events = {
EXIT: "onExit",
ENTER: "onEnter",
};
export { Events }
const HeadlessBoundaryEventTask = async ({event, ids}) => {
console.log(event, ids);
boundaryEventEmitter.emit(event, ids)
};
AppRegistry.registerHeadlessTask('OnBoundaryEvent', () => HeadlessBoundaryEventTask);
export default {
add: boundary => {
if (!boundary || (boundary.constructor !== Array && typeof boundary !== 'object')) {
throw TAG + ': a boundary must be an array or non-null object';
}
return new Promise((resolve, reject) => {
if (typeof boundary === 'object' && !boundary.id) {
reject(TAG + ': an id is required')
}
RNBoundary.add(boundary)
.then(id => resolve(id))
.catch(e => reject(e))
})
},
on: (event, callback) => {
if (typeof callback !== 'function') {
throw TAG + ': callback function must be provided';
}
if (!Object.values(Events).find(e => e === event)) {
throw TAG + ': invalid event';
}
return boundaryEventEmitter.addListener(event, callback);
},
off: (event) => {
if (!Object.values(Events).find(e => e === event)) {
throw TAG + ': invalid event';
}
return boundaryEventEmitter.removeAllListeners(event);
},
removeAll: () => {
return RNBoundary.removeAll();
},
remove: id => {
if (!id || (id.constructor !== Array && typeof id !== 'string')) {
throw TAG + ': id must be a string';
}
return RNBoundary.remove(id);
}
}
from react-native-boundary.
For iOS, According to this, I believe we need allowsBackgroundLocationUpdates
to be set to true: https://developer.apple.com/documentation/corelocation/handling_location_updates_in_the_background?language=objc
from react-native-boundary.
Related Issues (20)
- How to check boundary for a line/route between two points? HOT 1
- Pod Fail - HOT 5
- Boundary "on Enter" not firing on iOS 13
- New Event - Currently in the added geofence or not
- events not firing in android 10 in react-native 0.61.5 HOT 6
- Headless event listener not called when app is killed HOT 24
- [Android] Re-register boundaries on device boot
- Problem in testing the app HOT 1
- Boundary dont start when i allow only use in app HOT 4
- Is there any way that we can get events for Gps Turned off/on?
- Updated podspec file
- Headlessjs doesn't take effect when app is killed and when is background
- Issue PendingIntent.FLAG_IMMUTABLE app crashed on Android app Target 31 (Android 12) HOT 1
- Got error code 1004
- React Native Boundary Enter and Exit Trigger
- App Error JobIntentService HOT 2
- Pemission issue HOT 1
- need to reboot device for geofence in/out events
- how to integrate in kotlin
- new NativeEventEmitter()` requires a non-null argument.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-boundary.