Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with Boundary.add #34

Open
thomaslc66 opened this issue Jun 28, 2019 · 7 comments
Open

Error with Boundary.add #34

thomaslc66 opened this issue Jun 28, 2019 · 7 comments

Comments

@thomaslc66
Copy link

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.

@eddieowens
Copy link
Owner

There doesn't seem to be anything in this stack that is related to the lib. I'm not entirely sure what's wrong here. Does your app have any other dependencies? Is it just a clean app with only react-native-boundary installed?

@thomaslc66
Copy link
Author

thomaslc66 commented Jun 29, 2019

Yes my project is a react-native init app and then a copy paste of the permissions and of the componentWillmount and unmount method from your readme.md

Here you can find the complete repo : https://github.com/thomaslc66/Geofences

@thomaslc66
Copy link
Author

@eddieowens I don't know why but the Boundary.add() method is always going to catch an error.

@eddieowens
Copy link
Owner

@thomaslc66 I'm not seeing the "error :(" message in this stack. Is this the full stack? If there was an error in the add method I would expect to see something referencing that component.

@thomaslc66
Copy link
Author

@eddieowens did you clone my repo and launched it ? Because you would have seen it.

@indventures
Copy link

indventures commented Jul 23, 2019

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.

same issue,any solution yet ?

@iluhakhurtin
Copy link

iluhakhurtin commented Aug 2, 2019

Have the same issue on the first run for iOS. The window with location permissions appears and the red screen as well on calling Boundary.add. When the permission has been already granted the same code does not raise the issue.
I use 'standard' check for the permissions before adding an area:

    if (Platform.OS === "android") {
        PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION)
            .then(granted => {
                if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                    handleLocationAllowed();
                }
            });
    }
    else{
        handleLocationAllowed();
    }

I think solution should be somewhere here and the code should wait until permission is granted for iOS but I have no idea how to do it now. Usually it is recommended to do like in my code.
Want to try react-native-permissions library to check if location is allowed for iOS as well beforehand.

UPDATE:
I managed to fix the issue due to the library. So the code now is the following:

   Permissions.check("location").then(response => {
        switch(response){
            case "undetermined":
                //wait for the response
                Permissions.request("location", "always").then(response => {
                    if(response == "authorized" || response == "restricted"){
                        handleLocationAllowed();
                    }
                });
            break;

            case "authorized":
            case "restricted":
                handleLocationAllowed();
            break;
        }
    });   

This is called BEFORE adding anything into Boundary. Adding is called in 'handleLocationAllowed() method.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants