Lira requires certain permissions to function properly. This guide explains what permissions are needed and why.
Platforms: Android & iOS
Purpose: Record user's voice for speech-to-text conversion
- Permission:
RECORD_AUDIO - Location:
android/app/src/main/AndroidManifest.xml - Runtime Permission: Requested via
permission_handlerpackage - When requested: On first use when user taps the microphone button
- Permission:
NSMicrophoneUsageDescription - Location:
ios/Runner/Info.plist - Runtime Permission: Requested automatically by iOS when accessing microphone
- When requested: On first use when user taps the microphone button
Platforms: Android & iOS
Purpose: Communicate with the backend API for STT, LLM, and TTS
- Permission:
INTERNET - Location:
android/app/src/main/AndroidManifest.xml - Note: Internet permission is granted by default on Android
- Permission: Automatically granted (no explicit permission needed)
- Note: iOS allows network access by default for apps
Platforms: Android
Purpose: Save temporary audio files for processing
- Permissions:
WRITE_EXTERNAL_STORAGE,READ_EXTERNAL_STORAGE - Location:
android/app/src/main/AndroidManifest.xml - Note: For Android 10+ (API 29+), scoped storage is used automatically, so these may not be strictly required, but included for compatibility
-
User opens voice analysis screen
- App calls
VoiceAssistantService.initialize() - This calls
AudioService.initialize() AudioServicerequests microphone permission viaPermission.microphone.request()
- App calls
-
Permission dialog appears
- Android: System permission dialog
- iOS: System permission dialog with custom message from
NSMicrophoneUsageDescription
-
User grants/denies permission
- Granted: Recording can proceed
- Denied: User sees error message and must enable in settings
If the user denies microphone permission:
- First denial: App shows a SnackBar message explaining the need for permission
- Subsequent denials: User must manually enable in device settings
- Code location:
lib/screens/voice_analysis_screen.dart→_initializeService()
# Check current permissions
adb shell dumpsys package com.example.lira | grep permission
# Grant permission manually (for testing)
adb shell pm grant com.example.lira android.permission.RECORD_AUDIO
# Revoke permission (for testing)
adb shell pm revoke com.example.lira android.permission.RECORD_AUDIO- Permissions are managed through Settings app
- For testing, you can reset permissions by deleting and reinstalling the app
- Check: Ensure
permission_handleris inpubspec.yaml - Check: Verify Android manifest has
RECORD_AUDIOpermission - Check: Verify iOS Info.plist has
NSMicrophoneUsageDescription
- Check: Error handling in
_initializeService()method - Check: SnackBar is properly displayed in the widget tree
- Android: Check if ProGuard is stripping permission-related code
- iOS: Verify Info.plist is included in release build
- Request permission when needed: Don't request on app launch, only when user tries to use voice feature
- Explain why: The iOS description explains why microphone is needed
- Handle gracefully: Show clear error messages if permission is denied
- Provide fallback: Allow text input as alternative to voice
- Add permission status indicator in UI
- Add "Open Settings" button when permission is denied
- Request permission with better context (e.g., "We need microphone to hear your voice")