New mobile/ directory with Capacitor project: - Configurable server URL launcher (default: app.pedshub.com) - Android: foreground service + wake lock for background recording (AudioRecordingService preserved from existing TWA) - iOS: background audio mode + microphone permission - App ID: com.pedshub.scribe - Both platforms initialized and synced Existing android/ TWA project untouched — this is a separate project. Build: cd mobile && npx cap open android (or ios)
2.5 KiB
2.5 KiB
PedScribe Mobile App
Native mobile wrapper for Pediatric AI Scribe using Capacitor. Provides background audio recording that survives screen lock on both iOS and Android.
Features
- Background recording (screen lock safe)
- Configurable server URL (supports self-hosted instances)
- Android foreground service with wake lock for reliable recording
- iOS background audio mode
- App Store and Play Store ready
Prerequisites
- Node.js 18+
- Android Studio (for Android builds)
- Xcode 15+ (for iOS builds, macOS only)
- Apple Developer account ($99/yr for App Store)
- Google Play Developer account ($25 one-time)
Setup
cd mobile
npm install
npx cap sync
Build Android
# Open in Android Studio
npx cap open android
# Or build APK directly
cd android && ./gradlew assembleRelease
The APK will be at android/app/build/outputs/apk/release/app-release.apk
Build iOS
# Open in Xcode (macOS only)
npx cap open ios
# Build and sign in Xcode
# Product > Archive > Distribute
How It Works
- App launches with a local launcher page
- User enters their PedScribe server URL (default: app.pedshub.com)
- URL is saved to localStorage for future launches
- App navigates to the remote web app
- Web app runs inside the native WebView with full native API access
Background Recording
Android: Uses AudioRecordingService — a foreground service that acquires a wake lock and shows a persistent notification during recording. The CPU stays active even when the screen is off.
iOS: Uses UIBackgroundModes: audio in Info.plist, which allows the WKWebView to continue audio capture when the app is backgrounded.
App Structure
mobile/
capacitor.config.json # Capacitor configuration
package.json # Dependencies
src/
index.html # Launcher page (server URL config)
launcher.js # Auto-redirect logic
launcher.css # Launcher styles
android/ # Android native project
app/src/main/
java/com/pedshub/scribe/
MainActivity.java
AudioRecordingService.java
AndroidManifest.xml
ios/ # iOS native project
App/App/
Info.plist # Background audio + microphone permission
Changing the Default Server
Edit src/launcher.js and change the DEFAULT_URL variable:
var DEFAULT_URL = 'https://your-server.example.com';
Users can also change the server URL at any time from the launcher screen.