Skip to content

Commit

Permalink
Merge pull request Szops#44 from Szops/6-add-user-location-to-map-in-…
Browse files Browse the repository at this point in the history
…mobile

6 add user location to map in mobile
  • Loading branch information
StawKarpi authored Apr 3, 2022
2 parents 099d583 + 6942af2 commit bc9314b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions mobile/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {tintColor, navDarkColor} from './src/constants/colors';
import PointsContextProvider from './src/context/PointsContextProvider';
import LanguageContextProvider from './src/context/LanguageContextProvider';
import {useEffect} from 'react';
import {PermissionsAndroid} from 'react-native';
import {PermissionsAndroid, Alert} from 'react-native';

export default function App() {
useEffect(() => {
Expand All @@ -22,10 +22,11 @@ export default function App() {
const granted = await PermissionsAndroid.request(
PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,
);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('You can use geolocation');
} else {
console.log('Geolocation permission denied');
if (granted === PermissionsAndroid.RESULTS.DENIED) {
Alert.alert(
'Uwaga',
'Brak dostępu do lokalizacji. Twoja pozycja nie będzie wyświetlana na mapie.',
);
}
} catch (err) {
console.warn(err);
Expand Down

0 comments on commit bc9314b

Please sign in to comment.