Native Features, Permissions & Deployment
Using device features
Apps often need the camera, photo library, location, or notifications. With Expo, each is a small package with a simple JavaScript API — no native code required for the common cases.
npx expo install expo-image-picker expo-location
import * as ImagePicker from 'expo-image-picker';
async function pickImage() {
const result = await ImagePicker.launchImageLibraryAsync({ quality: 1 });
if (!result.canceled) {
setPhoto(result.assets[0].uri);
}
}
Requesting permissions
Sensitive features (camera, location) require the user’s permission at runtime. Always request it in context — when the user taps the feature — and handle a “denied” result gracefully.
import * as Location from 'expo-location';
async function getLocation() {
const { status } = await Location.requestForegroundPermissionsAsync();
if (status !== 'granted') {
alert('Location permission is needed for this feature');
return;
}
const loc = await Location.getCurrentPositionAsync();
console.log(loc.coords);
}
You also declare why you need each permission in app.json; iOS shows that text when asking, and rejects apps that omit it.
Storing data on the device
- AsyncStorage — simple key-value storage for small data (settings, a token cache).
- expo-secure-store — encrypted storage for secrets like auth tokens.
- SQLite / WatermelonDB — larger structured/offline data.
import AsyncStorage from '@react-native-async-storage/async-storage';
await AsyncStorage.setItem('theme', 'dark');
const theme = await AsyncStorage.getItem('theme');
Building & publishing with EAS
Expo’s EAS Build compiles your app in the cloud (no local Xcode/Android Studio needed) and EAS Submit uploads it to the stores.
npm install -g eas-cli
eas build --platform android # or ios
eas submit --platform android
You’ll still need a Google Play Console account and an Apple Developer account to publish, plus store listings (icon, screenshots, description).
Over-the-air updates
A big React Native advantage: with EAS Update you can ship JavaScript-only fixes instantly to users without going through app review — great for quick bug fixes (native changes still need a new store build).
Common mistakes
- Requesting permissions at app launch instead of when needed.
- Storing tokens in AsyncStorage (not encrypted) instead of SecureStore.
- Forgetting permission descriptions in
app.json(App Store rejection).
Summary: Use Expo modules for camera, location and more; request permissions in context and handle denial; store small data in AsyncStorage and secrets in SecureStore; and build/ship with EAS — with instant JS updates via EAS Update.