webyonet / react-native-android-location-services-dialog-box

React Native Android Location Services Dialog Box
MIT License
182 stars 50 forks source link

get error when location is on #17

Closed northern-fox closed 7 years ago

northern-fox commented 7 years ago

Looks like the app doesn't have the permission to access location. Add the following line to your app's AndroidManifest.xml:

Suresh-R-S commented 7 years ago

Any update on this? I'am getting this too. I've set the permission in AndroidManifest.xml. But when we see the permissions of the app in the settings, location is not seen. I'am testing it in a real device.

webyonet commented 7 years ago

I will solve this bug on the weekend

webyonet commented 7 years ago

This bug tested with RN-45 on android 6 tablet and android 7 mobile phone. No problems found. Please check your own code or upgrade to RN latest version.

webyonet commented 7 years ago
 LocationServicesDialogBox.checkLocationServicesIsEnabled({
            message: "Use Location ?",
            ok: "YES",
            cancel: "NO"
        }).then(function(success) {
            navigator.geolocation.getCurrentPosition((position) => {
                let initialPosition = JSON.stringify(position);
                this.setState({ initialPosition });
            }, error => console.log(error), { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 });
        }.bind(this)).catch(function(error) {
            this.setState({
                initialPosition: error.message
            });
        }.bind(this));