Skip to content

Instantly share code, notes, and snippets.

@jarakys
Created November 28, 2018 15:04
Show Gist options
  • Select an option

  • Save jarakys/1f96ef847faff9ee75dcef9e731a16b4 to your computer and use it in GitHub Desktop.

Select an option

Save jarakys/1f96ef847faff9ee75dcef9e731a16b4 to your computer and use it in GitHub Desktop.
_onFindCoordinates() {
try {
const granted = PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
{
'title': 'Location',
'message': 'test app access to your location'
}
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
Alert.alert('Now me can find you, and KIII')
} else {
Alert.alert('Это просто конец')
}
} catch (err) {
Alert.alert('ЕГГОР')
}
navigator.geolocation.getCurrentPosition(
position => {
const location = JSON.stringify(position);
this.setState({ stringCoordinate:location });
},
error => Alert.alert(error.message),
{ enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment