Let's think about it this way for a second
Before accessing a device feature (camera, location, contacts), you need to request permission from the user (an iOS/Android OS-level requirement) — packages like expo-camera and expo-location provide a requestPermissionsAsync() function, and you have to handle the user's 'Allow'/'Deny' choice. If permission is denied, gracefully disable/explain the feature — the app must not crash.
Let's connect this to a real-world scenario
Install expo-location and call Location.requestForegroundPermissionsAsync(), and the OS's native permission dialog will appear — once you get 'Allow', you can fetch GPS coordinates with Location.getCurrentPositionAsync(). Always check the permission status (granted/denied), and if status !== 'granted', show a UI message explaining that the feature is limited.
Code Example
import * as Location from 'expo-location';
import { useState, useEffect } from 'react';
import { Text } from 'react-native';
function LocationScreen() {
const [location, setLocation] = useState(null);
const [errorMsg, setErrorMsg] = useState(null);
useEffect(() => {
(async () => {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status !== 'granted') {
setErrorMsg('Location permission ကို ငြင်းပယ်ထားပါတယ်');
return;
}
const loc = await Location.getCurrentPositionAsync({});
setLocation(loc);
})();
}, []);
if (errorMsg) return <Text>{errorMsg}</Text>;
return <Text>{location ? JSON.stringify(location.coords) : 'Loading...'}</Text>;
}A permission dialog appears, and tapping 'Allow' displays the device's GPS coordinates on screen.Try it in 5 minutes
Install expo-location and implement the permission request + current location fetch flow yourself (on the Expo Go app).
A quick word of caution
Location/camera data is sensitive personal information — clearly explain to the user why it's needed before requesting permission, and if you send it to a backend, follow the encryption/HTTPS concepts from the Cybersecurity tutorial.