← Mobilalkalmazás fejlesztők adatlapja
Nézd meg, miben segít
Mobileszköz-jogosultságok
Minimális jogosultsággal és kifejezett megtagadási állapotokkal valósít meg helyzethez kötött eszközhozzáférést.
mobile-device-permissions
Ezt a skillt használó csapattagok
Mikor hasznos?
Kamera, médiaválasztás vagy biometrikus hitelesítés hozzáadásakor használd.
Miben segít neked?
- Előnyben részesíti a széles hozzáférést nem igénylő rendszerválasztót.
- Modellezi a kérést, megtagadást, tartós tiltást és későbbi visszavonást.
- Kezeli az átmeneti médiafájlt és natív jogosultságbeállítást.
Például ezt kérheted
Adj fotómellékletet rendszerválasztóval, megőrizve a piszkozatot megtagadott kamerajognál. Tiltsd a kamerát, válassz meglévő képet, majd térj vissza a választóból. A piszkozat maradjon meg, a felesleges ideiglenes fájl szabaduljon fel.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Device Features & Permissions
Integrate camera, media, files, geolocation, biometrics and sensors using the principle of least privilege, contextual permission prompts and full recovery when permissions are denied or revoked.
1. Zero-permission system pickers and least-privilege APIs
- Avoid broad storage/library permissions when a system picker suffices:
- Photos & Videos: use the system Photo Picker (
PHPickerViewController/ Android Photo Picker viaexpo-image-pickerorimage_picker), granting one-time read access to selected items withoutREAD_MEDIA_IMAGESor fullNSPhotoLibraryUsageDescriptionaccess. - Documents & Files: use the system Document Picker (
UIDocumentPickerViewController/ Android SAFACTION_OPEN_DOCUMENT) rather than broad storage permissions. - Location: request Approximate / Coarse (
ACCESS_COARSE_LOCATION) when city/region accuracy suffices, and When In Use (NSLocationWhenInUseUsageDescription/ACCESS_FINE_LOCATION) before escalating toAlways.
- Photos & Videos: use the system Photo Picker (
2. Contextual permission state machine
- Never request permissions on app startup: ask only when the user taps the action ("Scan QR code", "Find nearby stores", "Record voice note").
- Handle all 5 OS permission states explicitly:
| Permission Status | Required Application Behavior |
|---|---|
undetermined / notDetermined |
Show brief contextual explanation if non-obvious, then trigger the native OS prompt. |
granted |
Start the hardware feature and clean up on screen exit or app backgrounding. |
limited (iOS Photos / Coarse Location) |
Operate smoothly on selected photos or coarse coordinates; offer a button to "Manage selected photos" (presentLimitedLibraryPicker) or upgrade precision if needed. |
denied (can ask again on Android) |
Keep the screen usable; explain why the feature needs the permission and allow retrying when the user taps the action again. |
blocked / permanentlyDenied |
The OS will not re-prompt (canAskAgain === false). Show a clear inline fallback with an "Open Settings" button (Linking.openSettings() / openAppSettings()) and a manual alternative (e.g., manual address entry or file upload). |
- Re-check on foreground resume: users returning from OS Settings may have granted or revoked the permission; listen to
AppState/AppLifecycleListenerand refresh the permission state automatically.
3. Camera, media processing and temporary file hygiene
- Hardware lifecycle: pause/release camera preview sessions, barcode scanners, audio recorders, Bluetooth scans and GPS watchers immediately when the screen blurs/unmounts or the app enters
background. - Off-thread media compression & EXIF privacy: resize and compress captured photos/videos off the UI thread before upload, respect EXIF orientation, strip sensitive GPS EXIF metadata when sharing publicly, and delete temp files from
Caches/cacheDirectoryonce upload completes. - Simulator & missing-hardware fallback: check hardware availability (
Camera.isAvailableAsync(), sensor availability, simulator camera absence) and provide a file-picker or mock fallback so development and tablets without rear cameras never crash.
4. Biometrics and App Store / Google Play compliance
- Cryptographic biometric binding: use Face ID / Touch ID (
LocalAuthentication) and AndroidBiometricPromptto unlock a credential stored in the hardware-backed Keychain / Keystore (requireAuthentication: trueinexpo-secure-store,CryptoObjectinBiometricPrompt)—never as a client-only booleanif (authenticated) setLoggedIn(true)gate without a cryptographic session token. - Store review compliance: write concrete iOS
Info.plistNS...UsageDescriptionstrings explaining the exact user benefit (vague strings cause immediate App Store rejection) and declare<uses-feature android:name="android.hardware.camera" android:required="false" />on Android when hardware is optional.
Before you finish
- System pickers used where possible; only minimal required permissions declared in
Info.plist/AndroidManifest.xml. -
undetermined,granted,limited,deniedandblocked(withopenSettings) states all work. - Permission status re-syncs on foreground resume; camera/audio/GPS sessions stop on blur/background.
- Biometrics unlock Keychain/Keystore credentials; temp media files are cleaned up after use.
Csomagban lévő fájlok 2
LICENSE.txtSKILL.md
