Giter Club home page Giter Club logo

react-native-boundary's Introduction

react-native-boundary

A simple, native, and efficient geofencing/region monitoring react native library for both iOS and android.

Usage

import Boundary, {Events} from 'react-native-boundary';

class MyComponent extends Class {
  componentWillMount() {
    Boundary.add({
      lat: 34.017714,
      lng: -118.499033,
      radius: 50, // in meters
      id: "Chipotle",
    })
      .then(() => console.log("success!"))
      .catch(e => console.error("error :(", e));
   
    Boundary.on(Events.ENTER, id => {
      // Prints 'Get out of my Chipotle!!'
      console.log(`Get out of my ${id}!!`);
    });
    
    Boundary.on(Events.EXIT, id => {
      // Prints 'Ya! You better get out of my Chipotle!!'
      console.log(`Ya! You better get out of my ${id}!!`)
    })
  }
  
  componentWillUnmount() {
    // Remove the events
    Boundary.off(Events.ENTER)
    Boundary.off(Events.EXIT)

    // Remove the boundary from native API´s
    Boundary.remove('Chipotle')
      .then(() => console.log('Goodbye Chipotle :('))
      .catch(e => console.log('Failed to delete Chipotle :)', e))
  }
}

Getting started

$ npm install react-native-boundary --save

Automatic Installation

$ react-native link react-native-boundary

Manual installation

iOS

  1. In XCode, in the project navigator, right click LibrariesAdd Files to [your project's name]
  2. Go to node_modulesreact-native-boundary and add RNBoundary.xcodeproj
  3. In XCode, in the project navigator, select your project. Add libRNBoundary.a to your project's Build PhasesLink Binary With Libraries
  4. Run your project (Cmd+R)<

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.eddieowens.RNBoundaryPackage; to the imports at the top of the file
  • Add new RNBoundaryPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-boundary'
    project(':react-native-boundary').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-boundary/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-boundary')
    

Post Install

Android

Add the ACCESS_FINE_LOCATION permission to your AndroidManifest.xml like so,

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.mypackage">
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    ...
</manifest>

iOS

Before iOS 11: Add the following to your Info.plist:

  • NSLocationAlwaysUsageDescription

For iOS 11: Add the following to your Info.plist:

  • NSLocationWhenInUseUsageDescription
  • NSLocationAlwaysAndWhenInUseUsageDescription

API

Functions

Name Arguments Note
on event: event, callback: function Triggers the callback when the event occurs. The callback will be passed an array of boundary ids as strings. Can be called in the background
off event: event Removes bound event listeners
add boundary: boundary Adds a Boundary that can be triggered when an event occurs
remove id: string Removes a Boundary from being triggered. Boundaries will remain until remove or removeAll is called or the app is uninstalled
removeAll void Removes all boundaries and event callbacks.

Types

Boundary

Field Type Note
id string ID for your boundary. Value that is returned when an event is triggered
lat number Must be a valid latitude
lng number Must be a valid longitude
radius number In meters. It is highly suggested that the radius is greater than 50 meters

Events

Field Type Note
ENTER string Event for when a user enters a boundary
EXIT string Event for when a user exits a boundary

react-native-boundary's People

Contributors

eddieowens avatar edwinvrgs avatar joshgachnang avatar mikaelengstrom avatar nsbruce avatar ryanlntn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-boundary's Issues

[Android 8+] Crash when the app is in background

Hi @eddieowens,

In Android 8 and up it's not possible to start services when your app is in background. Proof

If you try to do so, you get an error. Here is a log with stack trace:

I/RNBoundary: Handling geofencing event
I/RNBoundary: Geofence transition: 1
I/RNBoundary: Enter geofence event detected. Sending event.
E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.sample.android, PID: 7277
    java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:354)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:764)
     Caused by: java.lang.IllegalStateException: Not allowed to start service Intent { cmp=com.sample.android/com.eddieowens.services.BoundaryEventHeadlessTaskService (has extras) }: app is in background uid UidRecord{8a05d06 u0a88 TRNB idle change:uncached procs:1 seq(0,0,0)}
        at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1577)
        at android.app.ContextImpl.startService(ContextImpl.java:1532)
        at android.content.ContextWrapper.startService(ContextWrapper.java:664)
        at com.eddieowens.services.BoundaryEventJobIntentService.sendEvent(BoundaryEventJobIntentService.java:71)
        at com.eddieowens.services.BoundaryEventJobIntentService.onHandleWork(BoundaryEventJobIntentService.java:46)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:392)
        at android.support.v4.app.JobIntentService$CommandProcessor.doInBackground(JobIntentService.java:383)
        at android.os.AsyncTask$2.call(AsyncTask.java:333)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:764) 

So the cause is this line.

Is this something we might hope to get fixed? And what would be ETA?

Thanks.

EDIT:
targetSdkVersion should be 26 or higher

[Android] Re-register boundaries on device boot

According to the Android documentation the boundaries need to be re-registered after an device boot:

The app must re-register geofences if they're still needed after the following events, since the system cannot recover the geofences in the following cases:

  • The device is rebooted. The app should listen for the device's boot complete action, and then re- register the geofences required.

https://developer.android.com/training/location/geofencing#re-register-geofences-only-when-required

Pemission issue

Hi Team
Please update the library for Android 13 and above version fix.

After Adding below facing some another issue
final int flag = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
mBoundaryPendingIntent = PendingIntent.getBroadcast(getReactApplicationContext(), 0, intent, flag);

package Manifest does not exist
int permission = ActivityCompat.checkSelfPermission(getReactApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION);

buildToolsVersion = "33.0.2"
minSdkVersion = 25
compileSdkVersion = 33
targetSdkVersion = 33

As per play store guidelines need to update the compile ands target sdk versions to 33

Please share the fix for this issue @eddieowens @harshit-kishor2

events not firing in android 10 in react-native 0.61.5

Code I use:

import React from 'react'
import {Component} from 'react';
import {
    View, Text, Dimensions,
} from 'react-native';
import Boundary, {Events} from 'react-native-boundary';

const {height} = Dimensions.get('window');

export default class Home extends Component {
    constructor(props) {
        super(props);

        this.state = {
            onEnter: false,
            onExit: false,
        };
    }

    componentDidMount() {
        console.log({state: this.state});
        Boundary.add({
            lat: 42.285232,
            lng: -85.626622,
            radius: 50, // in meters
            id: "Station",
        })
            .then(() => console.log("success!"))
            .catch(e => console.error("error :(", e));

        Boundary.on('onEnter', id => {
            this.setState(prev => ({...prev, onEnter: true}));
            console.log(`ON ENTER ${id}!!`);
        });

        Boundary.on('onExit', id => {
            this.setState(prev => ({...prev, onExit: true}));
            console.log(`ON EXIT ${id}!!`)
        });
    }

    componentWillUnmount() {

        // Remove the events
        Boundary.off(Events.ENTER);
        Boundary.off(Events.EXIT);

        Boundary.remove('Station')
            .then(() => console.log('Goodbye Station :('))
            .catch(e => console.log('Failed to delete Station :)', e))
    }

    render() {
        return (
            <View style={{
                backgroundColor: '#EAF0F6',
                height: height,
                justifyContent: 'flex-start',
                alignItems: 'flex-start',
            }}>
                <Text style={{fontSize: 18, color: '#707070'}}>{JSON.stringify(this.state)}</Text>
            </View>
        );

    }
}

the logs i only get.

 LOG  {"state": {"onEnter": false, "onExit": false}}
 LOG  Goodbye Station :(
 LOG  success!

Event Callbacks not firing: no listeners registered

Boundaries are registered and will trip if I move in and out of a region, but the callbacks never fire and I receive a YellowBox warning stating
"Sending 'onEnter' with no listeners registered"

Im using:
iOS 12.1
Android 8.1
react-native-boundary 1.0.7
react-native 0.57.3

My test implementation is dead simple.

componentWillMount() {
  Boundary.on(Events.ENTER, () => console.log('Entered'));
  Boundary.on(Events.EXIT, () => console.log('Exited'));
}
componentWillUnmount() {
  Boundary.removeAll();
}

Any idea or direction would be appreciated.

Originally posted by @adammacdonald in #20 (comment)

Updated podspec file

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-boundary/ios/RNBoundary.podspec b/node_modules/react-native-boundary/ios/RNBoundary.podspec
index 3587945..77a56bc 100644
--- a/node_modules/react-native-boundary/ios/RNBoundary.podspec
+++ b/node_modules/react-native-boundary/ios/RNBoundary.podspec
@@ -1,24 +1,20 @@
+require 'json'
+
+package = JSON.parse(File.read(File.join(__dir__, '../package.json')))
 
 Pod::Spec.new do |s|
   s.name         = "RNBoundary"
-  s.version      = "1.0.0"
-  s.summary      = "RNBoundary"
-  s.description  = <<-DESC
-                  RNBoundary
-                   DESC
-  s.homepage     = ""
-  s.license      = "MIT"
-  # s.license      = { :type => "MIT", :file => "FILE_LICENSE" }
-  s.author             = { "author" => "[email protected]" }
-  s.platform     = :ios, "7.0"
-  s.source       = { :git => "https://github.com/author/RNBoundary.git", :tag => "master" }
-  s.source_files  = "RNBoundary/**/*.{h,m}"
-  s.requires_arc = true
+  s.version      = package['version']
+  s.summary      = package['description']
+  s.license      = package['license']
 
+  s.authors      = package['author']
+  s.homepage     = "https://github.com/mikhailperemitko/react-native-boundary#readme"
+  s.platform     = :ios, "10.0"
 
-  s.dependency "React"
-  #s.dependency "others"
+  s.source       = { :git => "https://github.com/eddieowens/react-native-boundary.git", :tag => "#{s.version}" }
+  s.source_files  = "*.{h,m}"
+  s.requires_arc = true
 
+  s.dependency 'React'
 end
-
-  
\ No newline at end of file

This issue body was partially generated by patch-package.

new NativeEventEmitter()` requires a non-null argument.

Hey!

I am seeing the following error when I tried to run the library with an updated react-native version (0.73.3):

Digging deeper, I realized that the const {RNBoundary} = NativeModules; returns nothing.

const {RNBoundary} = NativeModules;

const TAG = "RNBoundary";

const boundaryEventEmitter = new NativeEventEmitter(RNBoundary);

I've also tried adding the methods startObserving/stopObserving recommended by the documentation without success.

Does anyone have any idea what I can do to fix it?

Thank you so much!

Platform

iOs

Environment

package version
react-native 0.73.3
react-native-boundary 1.1.1
node 18.16.1
npm or yarn npm v9.5.1

Build Failing on Android. Cannot find symbol JobIntentService

I've been trying to build this for android all day, and I'm completely stuck. The build always fails with the error:

BoundaryEventBroadcastReceiver.java:6: error: cannot find symbol
import android.support.v4.app.JobIntentService;
                             ^
  symbol:   class JobIntentService
  location: package android.support.v4.app

Environment:
OS: macOS High Sierra 10.13.4
Node: 8.9.4
Yarn: 1.3.2
npm: 5.6.0
Watchman: Not Found
Xcode: Xcode 9.3 Build version 9E145
Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
react: 16.3.1 => 16.3.1
react-native: 0.55.4 => 0.55.4

As far as i can tell, it is because JobIntentService was added as of support versions 26.1.0, and I'm getting some kind of version conflict? Its an older project an we're still using an older version of react-native, and quite a few other packages, and unfortunately due to breaking changes between RN 55 and 57 its not feasible to update at the moment.

I've tried added/updated the versions of compile 'com.android.support:appcompat-v7:26.1.0' and compile 'com.android.support:support-v4:26.1.0 to the dependencies block in my build.gradle, updating the compileSdkVersion to 26, Excluding the com.android.support from other projects...

But nothing seemed to work until as a last ditch effort I went into my node_modules folder and updated the build.gradle file in react-native-boundary to add compile 'com.android.support:support-v4:26.1.0 to the dependencies there, and finally got a successful build.

I'm still very new to mobile development, so I'm still not entirely familiar with all of this, but should compile 'com.android.support:support-v4:26.1.0 be added to this projects build.gradle dependancies? or am I still missing something?

Cant get Module to compile

First Error
screenshot from 2018-08-27 21-38-43

So i Commented out both google() entries from the Build.Gradle
Then i get the following
screenshot from 2018-08-27 21-43-01

And then I commented out the dependency and got the following
screenshot from 2018-08-27 21-45-26

I Assume i'm doing something horribly wrong here.
Being a complete noob I'd love to have some idea what ?! :)

Way to test this library?

How do I test this library? In Xcode, I can simulate location events only when the app is currently running. It doesn't let me simulate the device's location after the app has been killed. Is there a way to see if this geofencing works after the app has been killed?

Same question for Android too.

App Error JobIntentService

Hi Team
Getting below error in React native latest version(0.71.8)
Project Version details:
"react": "18.2.0",
"react-native": "0.71.8",
"react-native-boundary": "^1.1.1",

D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\receivers\BoundaryEventBroadcastReceiver.java:6: error: cannot find symbol
import android.support.v4.app.JobIntentService;
^
symbol: class JobIntentService
location: package android.support.v4.app
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:7: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:8: error: cannot find symbol
import android.support.v4.app.ActivityCompat;
^
symbol: class ActivityCompat
location: package android.support.v4.app
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventHeadlessTaskService.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:6: error: package android.support.annotation does not exist
import android.support.annotation.NonNull;
^
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:7: error: cannot find symbol
import android.support.v4.app.JobIntentService;
^
symbol: class JobIntentService
location: package android.support.v4.app
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:20: error: cannot find symbol
public class BoundaryEventJobIntentService extends JobIntentService {
^
symbol: class JobIntentService
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventHeadlessTaskService.java:12: error: cannot find symbol
@nullable
^
symbol: class Nullable
location: class BoundaryEventHeadlessTaskService
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:30: error: cannot find symbol
protected void onHandleWork(@nonnull Intent intent) {
^
symbol: class NonNull
location: class BoundaryEventJobIntentService
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:60: error: cannot find symbol
public void onFailure(@nonnull Exception e) {
^
symbol: class NonNull
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:143: error: cannot find symbol
int permission = ActivityCompat.checkSelfPermission(getReactApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION);
^
symbol: variable ActivityCompat
location: class RNBoundaryModule
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:166: error: cannot find symbol
public void onFailure(@nonnull Exception e) {
^
symbol: class NonNull
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:175: error: cannot find symbol
int permission = ActivityCompat.checkSelfPermission(getReactApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION);
^
symbol: variable ActivityCompat
location: class RNBoundaryModule
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:200: error: cannot find symbol
public void onFailure(@nonnull Exception e) {
^
symbol: class NonNull
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:220: error: cannot find symbol
public void onFailure(@nonnull Exception e) {
^
symbol: class NonNull
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:228: error: cannot find symbol
ActivityCompat.requestPermissions(getReactApplicationContext().getCurrentActivity(),
^
symbol: variable ActivityCompat
location: class RNBoundaryModule
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\RNBoundaryModule.java:234: error: cannot find symbol
return ActivityCompat.checkSelfPermission(getReactApplicationContext(), Manifest.permission.ACCESS_FINE_LOCATION);
^
symbol: variable ActivityCompat
location: class RNBoundaryModule
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\receivers\BoundaryEventBroadcastReceiver.java:21: error: cannot find symbol
JobIntentService.enqueueWork(context, BoundaryEventJobIntentService.class, 0, intent);
^
symbol: variable JobIntentService
location: class BoundaryEventBroadcastReceiver
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:29: error: method does not override or implement a method from a supertype
@OverRide
^
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:46: error: cannot find symbol
sendEvent(this.getApplicationContext(), ON_ENTER, enteredGeofences);
^
symbol: method getApplicationContext()
D:\MySamples\RNGeofenceTesting\node_modules\react-native-boundary\android\src\main\java\com\eddieowens\services\BoundaryEventJobIntentService.java:54: error: cannot find symbol
sendEvent(this.getApplicationContext(), ON_EXIT, exitingGeofences);
^
symbol: method getApplicationContext()
21 errors

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native-boundary:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

2: Task failed with an exception.

  • What went wrong:
    java.lang.StackOverflowError (no error message)

  • Try:

Run with --stacktrace option to get the stack trace.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
==============================================================================

BUILD FAILED in 1m 21s

at makeError (D:\MySamples\RNGeofenceTesting\node_modules\execa\index.js:174:9)
at D:\MySamples\RNGeofenceTesting\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\MySamples\RNGeofenceTesting\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7)
at async Command.handleAction (D:\MySamples\RNGeofenceTesting\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag for more details.

Error when enabling remote debugging

The javascript bundle wont load and xcode is outputting this:

[Client] Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash

Got error code 1000

I trying to implement this library in my project, when i am using 'Boundary.add' i got exception 1000.
i m using
"react-native": "0.55.0",
compileSdkVersion 27
buildToolsVersion "27.0.1"

Thanks in advance

React Native Boundary Enter and Exit Trigger

Hi Team
I have some doubts about this library

  1. Geofence Enter and Exit not triggering on all devices.
  2. Geofence Enter and Exit will work when the app is in Background.
  3. Does this library support offline geofence Enter and Exit?

Please do a replay ASAP as I have an Android app delivery and I am using this library for geofence events.
@eddieowens.

Thank you.

need to reboot device for geofence in/out events

Hi
I am facing 1 issue 1st time geofence in/out is working but after that, I need to reboot the device for events and then it is working. why it is happening like this?
can anyone help me?
Thank you.

Publish new version on npm package

Hello,
can you please update the npm package?
When I try to install it, I've always version 1.0.4 without the last merged PR.

Thanks!

Headless event listener not called when app is killed

Hey @eddieowens !

When the app is in foreground or background the boundary callbacks work perfectly!
But I am struggling with the Headless part when the app is killed.
In logcat I can see that the event is fired. I see the log message from boundary's index.js file:

ReactNativeJS: 'onExit', [ 'rated0' ]

which comes from this part of code here:

const HeadlessBoundaryEventTask = async ({event, ids}) => {
  console.log(event, ids);
  boundaryEventEmitter.emit(event, ids)
};

But my callback is never executed. I think the issue might be timing.
When the app starts because of a Headless event I can see that boundary receives the event as said above. I added log messages for the Callback Registration and it seems to happen after the Headless event:

15:03:19.837 ReactNativeJS: 'onExit', [ 'rated0' ] // from boundary's index.js
15:03:19.863 ReactNativeJS: Registering Boundary Callbacks // my code

I moved the callback registration to the very first line of my index.js but the order still seems to be incorrect. Any idea how to solve this? Where should I call the Boundary.on callback registration in my code?

Setup:

  • "react-native": "0.59.5"
  • "react-native-activity-recognition": "woffu/react-native-boundary" // fix for newer android versions

Help is very much appreciated :)

Location problem

Hello, Im currently trying to make an application that is using marker and your boundary but for some reason when I try to deactivate the location on android the application crash and I dont know why. (append after your boundary git installation) I want to know if I can remove any form of dependency to this problem.

'React/RCTDefines.h' file not found

Hello, I did the manual install but getting this error that i'm not too sure about, here is my podfile.

Screen Shot 2019-08-23 at 5 16 45 PM

platform :ios, '10.0'

target 'commonwealth-walkway' do
  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.12.4",
    :subspecs => [
      "Core"
    ],
    :inhibit_warnings => true

  # Install unimodules
  require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  use_unimodules!(
    modules_paths: ['../node_modules'],
    exclude: [
      'expo-bluetooth',
      'expo-in-app-purchases',
      'expo-payments-stripe',
    ],
  )

  pod 'React',
    :path => "../node_modules/react-native",
    :inhibit_warnings => true,
    :subspecs => [
      "Core",
      "ART",
      "RCTActionSheet",
      "RCTAnimation",
      "RCTCameraRoll",
      "RCTGeolocation",
      "RCTImage",
      "RCTNetwork",
      "RCTText",
      "RCTVibration",
      "RCTWebSocket",
      "DevSupport",
      "CxxBridge"
    ]
  pod 'yoga',
    :path => "../node_modules/react-native/ReactCommon/yoga",
    :inhibit_warnings => true
  pod 'DoubleConversion',
    :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
    :inhibit_warnings => true
  pod 'Folly',
    :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
    :inhibit_warnings => true
  pod 'glog',
    :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
    :inhibit_warnings => true

  post_install do |installer|
    installer.pods_project.main_group.tab_width = '2';
    installer.pods_project.main_group.indent_width = '2';

    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|

      if pod_name == 'ExpoKit'
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'
          
          # Enable Google Maps support
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS=1'
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS_UTILS=1'
          
        end
      end



      target_installation_result.native_target.build_configurations.each do |config|
        config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
      end


      # Can't specify this in the React podspec because we need to use those podspecs for detached
      # projects which don't reference ExponentCPP.
      if pod_name.start_with?('React')
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
          config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
        end
      end

      # Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
      # RCT_ENABLE_PACKAGER_CONNECTION disabled
      next unless pod_name == 'React'
      target_installation_result.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
      end

    end
  end
end

Events.ENTER and Events.EXIT callbacks not being fired on IOS or Android

Hi Eddie, I have followed the exact instructions provided by you for setup. I have also confirmed that all the steps for iOS and Android manual linking are present in my application. However, the callbacks I am providing to the ENTER and EXIT events are not being fired. I get successful logs for setting up the geofence, but any of the logs or callbacks within the on ENTER and EXIT events are not fired.

The only thing I have been able to see (only on Android) is if I am already inside the boundary, the ENTER event is called. But when I exit the boundary, the EXIT event is not called, and neither is the ENTER event on re-entering. And since iOS has limitation of ENTER not being called if you are already inside the location, I have not been able to trigger any events on iOS.

To test, we are generating iOS and Android builds, setting geofence for a point (lat,lng) 1km away from us. Then we are actually driving over to the the point and then driving back to the initial location 1km away. Radius in my code is 500m, but in no point during this entire process is the callback fired. And we are also ensuring to keep the application running in foreground at all times for both platforms.

Here is my code:

setGeoFences = async(responseServices) => {
const radius = 500;
responseServices.forEach((service) => {
if(service.work_location.latitude && service.work_location.longitude){
if(service.start_date <= fullDateToday && service.end_date >= fullDateToday){
console.log('date check successful! about to set geofence');
Boundary.add({ //async function
lat: parseFloat(service.work_location.latitude),
lng: parseFloat(service.work_location.longitude),
radius, // in meters
id: service.work_order_id,
})
.then(() => {
console.log("successfully set geofence!!!!");
Alert.alert(
'GEOFENCE SET!!!!!',
'SUCCESS!!!',
);
})
.catch(e => {
console.error("error in setting geofence!!!:(", e)
Alert.alert(
'GEOFENCE NOT SET',
'FAILURE!!!!',
);
});

    Boundary.on(Events.ENTER, ids => {
      // Prints 'Get out of my Chipotle!!'
      console.log('enterign boundary!!!!!!! IT WORKS!!!!!!!!!!');
      Alert.alert(
        'ENTERING BOUNDARY!!!!!!!',
        'IT WORKSS!!!',
      );
    });

    Boundary.on(Events.EXIT, ids => {
      // Prints 'Ya! You better get out of my Chipotle!!'
      console.log('leaving boundary!!!!!!! IT WORKS!!!!!!!!!!');
      Alert.alert(
        'EXITING BOUNDARY!!!!!!!',
        'IT WORKSS!!!',
      );
    });
  }
  else if(fullDateToday > service.end_date && service.geo_fence_set){
    console.log('Going to remove boundary!!!!');
    Boundary.remove(`${service.work_order_id}`)
      .then(() => {
        console.log('removed boundary for work order' + service.work_order_id);
        Alert.alert(
          'REMOVING BOUNDARY!!!!!!!',
          'successful!!!',
        );
      })
      .catch(e => {
        console.log(`Failed to delete workorder${service.work_order_id}`, e);
        Alert.alert(
          'REMOVING BOUNDARY!!!!!!!',
          'failed!!!',
        );
      })
  }
}

});
}

In my app, geofences need to be set for the location of "work orders" and workers will travel in and out of those locations, during which these callbacks need to be fired. This function is not within the componentDidMount of a screen, but rather called when the user's upcoming work orders are fetched and for each work order that is currently going on, I create a boundary around its lat lng values. In each case, I am seeing the log and alert for geofence set, but I am unable to get any enter/exit functionality to work except when I am already within the boundary on Android.

Please advise what I could be missing, or if there is anything incorrect with my code.

Will a boundary live forever if I don't remove it?

Hi Eddie, first of all thanks for your work on this library. It is much appreciated!

I wanted to first ask how much resources this library uses to set up a geofence boundary? My application needs to set geofences for each location of a user's 'workorders'. Currently it is set up to fetch the workorders and create the geofences every time the user logs in. This I know will cause redundancy. So I wanted to get an idea as to:

  • How taxing it is on the phone and the application to set geofences?

  • What happens if I keep recreating the same boundary over and over again, without removing a previous instance? Will it overwrite the previous one? Or will there end up being multiple geofences around the same location meaning the on ENTER and on EXIT functions will be called multiple times when a user crosses the boundary?

  • Also, what happens if I do not remove a boundary? Does it live forever?

Thanks again. I know these are not actually bugs but there was no other way for me to ask you these questions.

Can this run in the background?

Is there a way that I could create a background process that uses this code for geofencing, so something that runs while the app is not open? If so, would if affect the users battery life significantly?

Thanks

Issue PendingIntent.FLAG_IMMUTABLE app crashed on Android app Target 31 (Android 12)

Hello, we have been having this issue on Android app Target 31.
Ref document: https://stackoverflow.com/questions/67045607/how-to-resolve-missing-pendingintent-mutability-flag-lint-warning-in-android-a

I tried with solution add dependency into build.gradle
implementation 'androidx.work:work-runtime:2.7.1'

But it still does not work.

-> My latest solution to fix this which is using patch package to modify Native code

    private PendingIntent getBoundaryPendingIntent() {
        if (mBoundaryPendingIntent != null) {
            return mBoundaryPendingIntent;
        }
        Intent intent = new Intent(getReactApplicationContext(), BoundaryEventBroadcastReceiver.class);
        mBoundaryPendingIntent = PendingIntent.getBroadcast(getReactApplicationContext(), 0, intent, PendingIntent.
                FLAG_UPDATE_CURRENT);
        return mBoundaryPendingIntent;
    }

Change mBoundaryPendingIntent = PendingIntent.getBroadcast(getReactApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT); to

    final int flag =  Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
        mBoundaryPendingIntent = PendingIntent.getBroadcast(getReactApplicationContext(), 0, intent, flag);

I think we should create PR for this. Thanks.

Pod Fail -

[!] The RNBoundary pod failed to validate due to 1 error:
- ERROR | attributes: Missing required attribute homepage.
- WARN | source: The version should be included in the Git tag.
- WARN | description: The description is equal to the summary.

s.homepage = ""
Homepage "" , null throws pod install error.

Maybe Should be
s.homepage = "https://github.com/eddieowens/react-native-boundary/tree/master/ios"

This fixes bug for me, but I have to change it every time node_module updated ;(

how to integrate in kotlin

getting this error :

  • What went wrong:
    Could not determine the dependencies of task ':app:compileDebugJavaWithJavac'.

Could not resolve all task dependencies for configuration ':app:debugCompileClasspath'.
Could not find :react-native-boundary:.
Required by:
project :app

Not working with ExpoKit (MainApplication cannot be cast to ReactApplication)

Hi, I've successfully linked this library to my Expo-detached project (ExpoKit), but the problem is when I should receive the event (in logcat I can see "RNBoundary: Enter geofence event detected. Sending event.") on Android I'm always getting this fatal exception:

E/AndroidRuntime: FATAL EXCEPTION: main java.lang.RuntimeException: Unable to start service com.eddieowens.services.BoundaryEventHeadlessTaskService@4734458 with Intent { cmp=/com.eddieowens.services.BoundaryEventHeadlessTaskService (has extras) }: java.lang.ClassCastException: host.exp.exponent.MainApplication cannot be cast to com.facebook.react.ReactApplication at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3904) at android.app.ActivityThread.access$1700(ActivityThread.java:237) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7045) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) Caused by: java.lang.ClassCastException: host.exp.exponent.MainApplication cannot be cast to com.facebook.react.ReactApplication at com.facebook.react.HeadlessJsTaskService.getReactNativeHost(HeadlessJsTaskService.java:169) at com.facebook.react.HeadlessJsTaskService.startTask(HeadlessJsTaskService.java:98) at com.facebook.react.HeadlessJsTaskService.onStartCommand(HeadlessJsTaskService.java:51) at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3885) at android.app.ActivityThread.access$1700(ActivityThread.java:237)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1816)  at android.os.Handler.dispatchMessage(Handler.java:106)  at android.os.Looper.loop(Looper.java:214)  at android.app.ActivityThread.main(ActivityThread.java:7045)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965) 

Any idea or direction would be appreciated.

Expo 31.0.2
Android 9
react-native-bundary 1.0.8

googlePlayServicesVersion does not match play-services-location versions

I get the following error when trying to build on Android:

Could not find com.google.android.gms:play-services-location:17.4.55.

This matches the googlePlayServicesVersion = "17.4.55" I have set in my project android/build.grade file. As seen in the Android release notes, the latest version of play-services-location is 16.0.0.

After Google Play services 15.0.0, the Play services libraries versions do not have to strictly match, as they follow SemVer. (reference)

I can work around this issue by using the latest version by setting the dependency to implementation "com.google.android.gms:play-services-location:+", but it's not a particularly satisfying solution.

crash when event fire on iOS

  Binaries:
    Node: 11.13.0 - /usr/local/bin/node
    Yarn: 1.12.3 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 26, 28, 29
      Build Tools: 27.0.3, 28.0.2, 28.0.3, 29.0.0
      System Images: android-26 | Intel x86 Atom, android-26 | Intel x86 Atom_64, android-28 | Intel x86 Atom, android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Intel x86 Atom_64
      Android NDK: 20.0.5594570
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5522156
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: ^16.8.6 => 16.8.6 
    react-native: ^0.60.0-rc.2 => 0.60.0-rc.2

When Im enter region or exit region the xCode throw this error

019-07-02 17:23:20.740138+0700 NAEM[28860:404870] [Client] Sending selectors failed with: Error Domain=NSCocoaErrorDomain Code=4099 "The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated." UserInfo={NSDebugDescription=The connection to service named com.apple.commcenter.coretelephony.xpc was invalidated.}
2019-07-02 17:23:20.761 [warn][tid:main][RCTEventEmitter.m:53] Sending `authorizationStatusDidChange` with no listeners registered.
2019-07-02 17:23:20.760786+0700 NAEM[28860:404628] Sending `authorizationStatusDidChange` with no listeners registered.
Resetting player.
2019-07-02 17:23:20.783250+0700 NAEM[28860:404757] [Client] Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash
2019-07-02 17:23:20.785925+0700 NAEM[28860:404757] [Client] Failure to deallocate CLLocationManager on the same runloop as its creation may result in a crash
2019-07-02 17:23:23.466 [info][tid:main][RCTRootView.m:293] Running application NAEM ({
    initialProps =     {
    };
    rootTag = 11;
})
2019-07-02 17:23:23.466300+0700 NAEM[28860:404628] Running application NAEM ({
    initialProps =     {
    };
    rootTag = 11;
})
2019-07-02 17:23:24.423 [info][tid:com.apple.root.default-qos][RCTImageLoader.m:746] [PERF ASSETS] Loading image at size {1624, 2436}, which is larger than the screen size {1125, 2436}
2019-07-02 17:23:24.422951+0700 NAEM[28860:404841] [PERF ASSETS] Loading image at size {1624, 2436}, which is larger than the screen size {1125, 2436}
2019-07-02 17:23:29.681622+0700 NAEM[28860:404628] didEnter : CLCircularRegion (identifier:'Chipotle', center:<+16.06929900,+108.23338600>, radius:1000.00m)
2019-07-02 17:23:29.684771+0700 NAEM[28860:404628] -[CLCircularRegion minor]: unrecognized selector sent to instance 0x6000027314c0
2019-07-02 17:23:29.712897+0700 NAEM[28860:404628] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[CLCircularRegion minor]: unrecognized selector sent to instance 0x6000027314c0'
*** First throw call stack:
(
	0   CoreFoundation                      0x000000010a1c06fb __exceptionPreprocess + 331
	1   libobjc.A.dylib                     0x0000000108419ac5 objc_exception_throw + 48
	2   CoreFoundation                      0x000000010a1deab4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
	3   CoreFoundation                      0x000000010a1c5443 ___forwarding___ + 1443
	4   CoreFoundation                      0x000000010a1c7238 _CF_forwarding_prep_0 + 120
	5   NAEM                               0x0000000105b4855b -[RNiBeacon convertBeaconRegionToDict:] + 91
	6   NAEM                               0x0000000105b4a86e -[RNiBeacon locationManager:didEnterRegion:] + 94
	7   CoreLocation                        0x000000010b23fd5e CLClientStopVehicleHeadingUpdates + 71503
	8   CoreLocation                        0x000000010b23e92a CLClientStopVehicleHeadingUpdates + 66331
	9   CoreLocation                        0x000000010b22a330 CLClientInvalidate + 1297
	10  CoreFoundation                      0x000000010a127aec __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
	11  CoreFoundation                      0x000000010a1272b0 __CFRunLoopDoBlocks + 336
	12  CoreFoundation                      0x000000010a12210b __CFRunLoopRun + 2747
	13  CoreFoundation                      0x000000010a121302 CFRunLoopRunSpecific + 626
	14  GraphicsServices                    0x00000001109512fe GSEventRunModal + 65
	15  UIKitCore                           0x0000000114dfaba2 UIApplicationMain + 140
	16  NAEM                               0x00000001056e1130 main + 112
	17  libdyld.dylib                       0x000000010e085541 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Im using these dependencies

"dependencies": {
    "@mapbox/react-native-mapbox-gl": "^6.1.3",
    **_"@mauron85/react-native-background-geolocation": "^0.5.3",_**
    "@monterosa/react-native-parallax-scroll": "^1.8.0",
    "@react-native-community/netinfo": "^3.2.1",
    "@react-native-mapbox-gl/maps": "^7.0.0-rc3",
    "@turf/boolean-contains": "^6.0.1",
    "@turf/center": "^6.0.1",
    "@turf/centroid": "^6.0.2",
    "@turf/circle": "^6.0.1",
    "@turf/helpers": "^6.1.4",
    "@turf/meta": "^6.0.2",
    "@turf/point-on-feature": "^5.1.5",
    "@turf/transform-translate": "^5.1.5",
    "accept-language-parser": "^1.5.0",
    "apollo-boost": "^0.1.28",
    "apollo-cache-inmemory": "^1.6.2",
    "apollo-cache-persist": "^0.1.1",
    "apollo-client": "^2.6.3",
    "apollo-link": "^1.2.12",
    "apollo-link-context": "^1.0.18",
    "apollo-link-http": "^1.5.15",
    "autoresponsive-react-native": "^1.0.9",
    "axios": "^0.18.1",
    "core-js": "^3.1.4",
    "country-flags": "0.0.2",
    "geolib": "^2.0.24",
    "get-youtube-id": "^1.0.1",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.10.1",
    "i18next": "^11.10.2",
    "install": "^0.12.2",
    "jwt-decode": "^2.2.0",
    "lodash": "^4.17.11",
    "lottie-react-native": "^2.6.1",
    "moment": "^2.24.0",
    "native-base": "^2.12.1",
    "npm": "^6.9.0",
    "querystring": "^0.2.0",
    "react": "^16.8.6",
    "react-apollo": "^2.5.6",
    "react-flags-svg": "^1.0.0",
    "react-i18next": "^7.13.0",
    "react-instantsearch-native": "^5.7.0",
    "react-native": "^0.60.0-rc.2",
    "react-native-animatable": "1.3.0",
    "react-native-app-intro-slider": "^1.0.1",
    "react-native-app-settings": "^2.0.1",
    "react-native-autolink": "^1.8.1",
    "react-native-background-timer": "^2.1.1",
    **_"react-native-beacons-manager": "github:nuonic/react-native-beacons-manager#master",_**
    "react-native-bluetooth-status": "^1.3.0",
    "react-native-boundary": "^1.1.1",
    "react-native-camera": "git+https://[email protected]/react-native-community/react-native-camera.git",
    "react-native-circular-progress": "^1.1.0",
    "react-native-config": "^0.11.7",
    "react-native-countdown-component": "^1.8.3",
    "react-native-device-info": "^2.1.2",
    "react-native-fetch-blob": "^0.10.8",
    "react-native-iap": "^3.2.3",
    "react-native-image-cache-hoc": "^1.5.1",
    "react-native-image-header-scroll-view": "^0.8.2",
    "react-native-image-slider": "^2.0.3",
    "react-native-image-zoom-viewer": "^2.2.26",
    "react-native-jwt-io": "^1.0.3",
    "react-native-languages": "^2.0.1",
    "react-native-linear-gradient": "^2.5.4",
    "react-native-loading-spinner-overlay": "^1.0.1",
    "react-native-material-ripple": "^0.8.0",
    "react-native-mime-types": "^2.2.1",
    "react-native-navigation-bar-color": "0.0.9",
    "react-native-open-maps": "^0.3.3",
    "react-native-orientation-locker": "^1.1.6",
    "react-native-permissions": "^1.1.1",
    "react-native-pose": "^0.3.0",
    "react-native-push-notification": "3.1.1",
    "react-native-qrcode-scanner": "github:moaazsidat/react-native-qrcode-scanner#04b83fcd",
    "react-native-scalable-image": "^0.4.0",
    "react-native-shimmer-placeholder": "^1.0.35",
    "react-native-slider": "github:jeanregisser/react-native-slider#951d00fc",
    "react-native-snap-carousel": "3.7.4",
    "react-native-splash-screen": "^3.2.0",
    "react-native-statusbar-alert": "^0.4.0",
    "react-native-svg": "^6.5.3",
    "react-native-svg-uri": "^1.2.3",
    "react-native-swift": "^1.2.2",
    "react-native-track-player": "^1.2.0",
    "react-native-vector-icons": "^5.0.0",
    "react-native-view-overflow": "0.0.3",
    "react-navigation": "^2.18.3",
    "react-navigation-backhandler": "^1.3.2",
    "react-navigation-is-focused-hoc": "^1.1.1",
    "react-redux": "^5.1.1",
    "react-timer-mixin": "^0.13.4",
    "recompose": "^0.30.0",
    "redux": "^4.0.1",
    "redux-devtools-extension": "^2.13.8",
    "redux-persist": "^5.10.0",
    "redux-reset": "^0.3.0",
    "styled-components": "^3.4.10",
    "url": "^0.11.0"
  },
**_"@mauron85/react-native-background-geolocation": "^0.5.3",_**
**_"react-native-beacons-manager": "github:nuonic/react-native-beacons-manager#master",_**

I think it conflict with highlight dependencies I marked.
Please help me fix this error

Problem in testing the app

Hi, before explaining the problem, let me tell you what i am doing,

i have a app which has two packages React native boundary and react native background job, what RN background job do is that it run when your app is closed, In short work in background

now what i have done that i created a feature which monitor your location when you are in boundary or outside the boundary and it will sent you a local notification telling you your current situation OK

now i am testing the feature using "Fake GPS" app, what i am doing is i change the location and RN boundary detect the change and send me notification, everything work perfectly till here OK

NOW HERE IS THE PROBLEM
WHEN I ZOOM IN FAKE GPS TO ITS MAXIMUM AND CHANGE THE LOCATION, THEN BOUNDARY PACKAGE DIDNT DETECT AND NO RENDERING CONDITION OCCURED, BUT WHEN PAUSE PLAY THE FAKE GPS, Boundary started to work,

NOW I AM CONFUSE, ITS THE PROBLEM OF FAKE GPS OR BOUNDARY, WHAT SHOULD I DO TO TEST PROPERLY

New Event - Currently in the added geofence or not

Is it possible to add some new events to this package? If the user adds a boundary and they are currently in the geofence. It would be great if an event can be fired determining if the user is currently in or outside of the geofence that was added. The current Events (enter & exit) don't pick this up.

Is possible to make it work without fine location activated? (Only iOS)

Hello,
I'm interested in this library, but I don't need an "always" permission when using my app, but only when in use.
Is it possible to do?
When the app has only "when in use" permission, I get the error:
"Access fine location is not permitted".

Is related to the permission level?

Thanks

Got error code 1004

I'm getting error of code 1004 in my console, when trying Boundary.add like below-

Error :( [Error: 1004: ]

Kindly help me fixing this error. @eddieowens
Thank you!

Integrate HeadlessJs into Android

Currently, Android events will not trigger in the background if the app is in doze mode. In order to get around this, @BrantApps suggested the following

As far as I can tell, the BoundaryEventBroadcastReceiver is going to fire when we enter a geofence - all good there. With the code I wrote, these events would make it through to the JS layer if RNBoundaryModule has a context and a resumed owning activity. For an activity to be resumed, it needs to have been pretty close to being "on-screen" in the recent past or close future if that makes sense.

In native-native land (not RN), you would do your application work in the Job. I think the next evolution of this code for react-native before it can be merged would be to;

  1. In BoundaryEventJobIntentService#sendEvent(String event, ArrayList<String> params) refactor to start a HeadlessJS task with the name of the JS function to invoke with those parameters. Something like;
   private void sendEvent(String event, ArrayList<String> params) {
       final Bundle bundle = new Bundle();
       bundle.putString("event", event);
       bundle.putStringArrayList("params", params);
       new HeadlessJsTaskConfig(
               "GeofenceDataChanged", // JS function to call
               bundle, // The data to send
               5000, // Timeout for the task
               true); // Allowed in foreground
   }
  1. Figure out how to extend both JobIntentService and HeadlessJsTaskService, probably create a custom JobIntentHeadlessJsTaskService - has one of these been done already?
  2. Write the "GeofenceDataChanged" code in the JS layer to handle the events.
  3. Extend the library implementation to handle device restarts/location toggling. (Apparently on Android, the geofences are removed if the device reboots or the location functionality is toggled?)

I agree with this approach and think it's the best way to ensure all events trigger in the background.

Error with Boundary.add

First install, react-native link is ok as i've check the manual config and everything seems ok.

Copy paste the example in the readme and got this error:
image

Maybe someone already encountred this?

I'm using an emulator and probaly will test it on a real phone to see if it's something related.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.