Closed NamanAulakh closed 6 years ago
package.json: "react-native": "^0.51.0", "react-native-android-location-services-dialog-box": "^2.4.3",
package.json
Code:
LocationServicesDialogBox.checkLocationServicesIsEnabled({ message: "<h2>Use Location ?</h2>This app wants to change your device settings:<br/><br/>Use GPS, Wi-Fi, and cell network for location<br/><br/><a href='#'>Learn more</a>", ok: 'YES', cancel: 'NO', enableHighAccuracy: true, // true => GPS AND NETWORK PROVIDER, false => ONLY GPS PROVIDER showDialog: true, // false => Opens the Location access page directly openLocationServices: true, // false => Directly catch method is called if location services are turned off preventOutSideTouch: false, // true => To prevent the location services popup from closing when it is clicked outside preventBackClick: false, // true=>To prevent the location services popup from closing when it is clicked back }) .then(success => { // success => {alreadyEnabled: true, enabled: true, status: "enabled"} navigator.geolocation.getCurrentPosition( position => { const initialPosition = JSON.stringify(position) this.setState({ initialPosition }) }, error => console.log(error), { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }, ) }) .catch(error => { console.log(error.message) })
Solution: restart again.
package.json
: "react-native": "^0.51.0", "react-native-android-location-services-dialog-box": "^2.4.3",Code: