Device Integration
Purpose
Design the integration strategy for device hardware APIs (camera, sensors, biometrics, Bluetooth, etc.), including permission flows, fallback behavior, and cross-platform abstraction.
Inputs
- Feature requirements involving hardware capabilities
- Target platforms and OS version minimums
- Cross-platform framework (if applicable)
- Privacy requirements and data sensitivity
Process
Step 1: Inventory Required Capabilities
List every hardware API the feature needs:
- Camera (photo, video, barcode scanning)
- Location (GPS, network-based, background location)
- Biometrics (Face ID, Touch ID, fingerprint, device PIN fallback)
- Bluetooth (BLE scanning, pairing, data transfer)
- Sensors (accelerometer, gyroscope, compass, barometer)
- Push notifications (remote, local, rich notifications)
- Haptics (impact, selection, notification feedback)
- Other (NFC, ARKit/ARCore, HealthKit)
Step 2: Map Permission Requirements
For each capability, document:
- iOS permission: NSCameraUsageDescription, NSLocationWhenInUseUsageDescription, etc.
- Android permission: CAMERA, ACCESS_FINE_LOCATION, USE_BIOMETRIC, etc.
- Runtime vs install-time: Which permissions need runtime prompts
- Purpose strings: User-facing explanation for each permission
- Privacy manifest entries: (iOS 17+ privacy manifest requirements)
Step 3: Design Permission Flow
For each permission:
- Pre-prompt education: Explain why the permission is needed before the system dialog
- First request timing: When in the user flow to request (not on launch — at the moment of need)
- Denial handling: What the feature does if permission is denied
- Settings redirect: How to guide the user to Settings if they denied and changed their mind
- Partial permission: Handle "While Using" vs "Always" for location, "Limited" for photos
Step 4: Evaluate Cross-Platform Abstraction
If using a cross-platform framework:
- Identify which APIs have mature cross-platform libraries
- Flag which capabilities require native modules or platform-specific code
- Assess abstraction quality (does the library expose all platform-specific options?)
- Plan for platform differences (Face ID vs fingerprint, iOS haptics vs Android vibration)
Step 5: Design Fallback Behavior
For each capability, define behavior when:
- Hardware is absent (no NFC chip, no biometric sensor)
- Permission is denied (camera denied, location denied)
- Hardware fails (GPS can't get a fix, Bluetooth disconnects)
- OS version doesn't support the API
Step 6: Power and Performance Impact
Assess battery and performance cost:
- Background location tracking power draw
- Continuous sensor polling vs event-driven
- Bluetooth scanning intervals and power modes
- Camera session lifecycle management
Output Format
# Device Integration Plan
## Capability Matrix
| Capability | iOS | Android | Cross-Platform Library | Native Required |
|-----------|-----|---------|----------------------|-----------------|
| Camera | Yes | Yes | expo-camera | No |
| BLE | Yes | Yes | react-native-ble-plx | No |
| Face ID | Yes | N/A | expo-local-auth | Partial |
## Permission Map
| Capability | iOS Permission | Android Permission | Timing | Purpose String |
|-----------|---------------|-------------------|--------|----------------|
| Camera | NSCameraUsageDescription | CAMERA | On first scan | "Scan barcodes..." |
## Permission Flow
### [Capability Name]
1. User taps [action]
2. Show education screen: "[Why we need this]"
3. System permission dialog
4. If granted: [proceed]
5. If denied: [fallback behavior]
6. If denied permanently: [settings redirect with instructions]
## Fallback Matrix
| Capability | Hardware Absent | Permission Denied | Hardware Failure |
|-----------|----------------|-------------------|-----------------|
| Camera | [Fallback] | [Fallback] | [Fallback] |
## Power Impact
| Capability | Active Draw | Mitigation |
|-----------|------------|------------|
| GPS | ~50mA | Use significant-change monitoring |
Quality Checks
Evolution Notes
1---2name: device-integration3department: "pathfinder"4description: "Hardware API integration — sensors, permissions, biometrics"5version: 16triggers:7 - "camera"8 - "GPS"9 - "biometric"10 - "Face ID"11 - "Touch ID"12 - "NFC"13 - "haptic"14 - "sensor"15 - "permission"16 - "bluetooth"17 - "accelerometer"18 - "push notification"19---2021# Device Integration2223## Purpose2425Design the integration strategy for device hardware APIs (camera, sensors, biometrics, Bluetooth, etc.), including permission flows, fallback behavior, and cross-platform abstraction.2627## Inputs2829- Feature requirements involving hardware capabilities30- Target platforms and OS version minimums31- Cross-platform framework (if applicable)32- Privacy requirements and data sensitivity3334## Process3536### Step 1: Inventory Required Capabilities3738List every hardware API the feature needs:39- Camera (photo, video, barcode scanning)40- Location (GPS, network-based, background location)41- Biometrics (Face ID, Touch ID, fingerprint, device PIN fallback)42- Bluetooth (BLE scanning, pairing, data transfer)43- Sensors (accelerometer, gyroscope, compass, barometer)44- Push notifications (remote, local, rich notifications)45- Haptics (impact, selection, notification feedback)46- Other (NFC, ARKit/ARCore, HealthKit)4748### Step 2: Map Permission Requirements4950For each capability, document:51- **iOS permission:** NSCameraUsageDescription, NSLocationWhenInUseUsageDescription, etc.52- **Android permission:** CAMERA, ACCESS_FINE_LOCATION, USE_BIOMETRIC, etc.53- **Runtime vs install-time:** Which permissions need runtime prompts54- **Purpose strings:** User-facing explanation for each permission55- **Privacy manifest entries:** (iOS 17+ privacy manifest requirements)5657### Step 3: Design Permission Flow5859For each permission:60- **Pre-prompt education:** Explain why the permission is needed before the system dialog61- **First request timing:** When in the user flow to request (not on launch — at the moment of need)62- **Denial handling:** What the feature does if permission is denied63- **Settings redirect:** How to guide the user to Settings if they denied and changed their mind64- **Partial permission:** Handle "While Using" vs "Always" for location, "Limited" for photos6566### Step 4: Evaluate Cross-Platform Abstraction6768If using a cross-platform framework:69- Identify which APIs have mature cross-platform libraries70- Flag which capabilities require native modules or platform-specific code71- Assess abstraction quality (does the library expose all platform-specific options?)72- Plan for platform differences (Face ID vs fingerprint, iOS haptics vs Android vibration)7374### Step 5: Design Fallback Behavior7576For each capability, define behavior when:77- Hardware is absent (no NFC chip, no biometric sensor)78- Permission is denied (camera denied, location denied)79- Hardware fails (GPS can't get a fix, Bluetooth disconnects)80- OS version doesn't support the API8182### Step 6: Power and Performance Impact8384Assess battery and performance cost:85- Background location tracking power draw86- Continuous sensor polling vs event-driven87- Bluetooth scanning intervals and power modes88- Camera session lifecycle management8990## Output Format9192```markdown93# Device Integration Plan9495## Capability Matrix96| Capability | iOS | Android | Cross-Platform Library | Native Required |97|-----------|-----|---------|----------------------|-----------------|98| Camera | Yes | Yes | expo-camera | No |99| BLE | Yes | Yes | react-native-ble-plx | No |100| Face ID | Yes | N/A | expo-local-auth | Partial |101102## Permission Map103| Capability | iOS Permission | Android Permission | Timing | Purpose String |104|-----------|---------------|-------------------|--------|----------------|105| Camera | NSCameraUsageDescription | CAMERA | On first scan | "Scan barcodes..." |106107## Permission Flow108### [Capability Name]1091. User taps [action]1102. Show education screen: "[Why we need this]"1113. System permission dialog1124. If granted: [proceed]1135. If denied: [fallback behavior]1146. If denied permanently: [settings redirect with instructions]115116## Fallback Matrix117| Capability | Hardware Absent | Permission Denied | Hardware Failure |118|-----------|----------------|-------------------|-----------------|119| Camera | [Fallback] | [Fallback] | [Fallback] |120121## Power Impact122| Capability | Active Draw | Mitigation |123|-----------|------------|------------|124| GPS | ~50mA | Use significant-change monitoring |125```126127## Quality Checks128129- [ ] Every required permission has a user-facing purpose string130- [ ] Permission requests happen at moment of need, not on app launch131- [ ] Every capability has fallback behavior for denial, absence, and failure132- [ ] Cross-platform libraries are evaluated for API completeness133- [ ] Power impact is assessed for continuous-use capabilities134- [ ] iOS privacy manifest requirements are addressed (iOS 17+)135- [ ] Android runtime vs install-time permissions are correctly categorized136137## Evolution Notes138<!-- Observations appended after each use -->