pediatric-ai-scribe-v3/mobile
Daniel f31afcdbf4 Fix biometric login, and keep recording alive across screen lock
Biometric sign-in has never worked. auth.js drove
window.Capacitor.Plugins.NativeBiometric — the API of
capacitor-native-biometric, which is not a dependency of this project. The
installed plugin is @aparajita/capacitor-biometric-auth, registered as
BiometricAuthNative with an entirely different API and no credential
storage at all. bioPlugin() therefore always returned null, bioAvailable()
always resolved {ok:false}, and the button was never revealed.

Rewritten against what is actually installed, with no new dependency:
BiometricAuthNative (checkBiometry/authenticate) presents the prompt, and
the already-working SecureStoragePlugin — via the window.SecureStorage
wrapper — holds the credentials. Credentials are only read after
authenticate() resolves, so the OS still gates access. biometryType is a
numeric enum in this plugin, so the old FACE_ID/TOUCH_ID string maps are
replaced with a single lookup exposed as typeName.

Secure storage itself was fine and is unchanged: SecureStoragePlugin
matches the name the wrapper looks up and is registered in
capacitor.settings.gradle.

Recording across screen lock: window.nativeKeepAwake() called Capacitor's
KeepAwake plugin, which is also not installed here, so it silently did
nothing and the device slept mid-encounter — taking the WebView's
MediaRecorder with it. keepAwake() is now a method on the existing
NativeRecording JavascriptInterface, which sets FLAG_KEEP_SCREEN_ON, and
is bound to the WebView so it survives the launcher's navigation to the
remote origin. The Capacitor plugin remains a fallback.

If the screen is locked anyway (power button, incoming call), the activity
pauses and Chromium throttles timers for hidden WebViews, starving
MediaRecorder's chunk delivery. MainActivity now calls resumeTimers() on
pause while recording. The foreground service was already correct — it
holds a partial wake lock and declares FOREGROUND_SERVICE_TYPE_MICROPHONE.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-31 01:12:47 +02:00
..
android Fix biometric login, and keep recording alive across screen lock 2026-07-31 01:12:47 +02:00
ios feat(mobile): biometric sign-in (Face ID / Touch ID / fingerprint) 2026-04-28 03:09:38 +02:00
src Fix Android mic permission, simplify launcher, remove broken biometric 2026-04-11 03:34:47 +02:00
.gitignore Add mobile/.gitignore (should have been in prior cleanup commit) 2026-04-14 23:39:26 +02:00
capacitor.config.json Mobile app hardening — security + Android 14 compat 2026-04-14 04:15:27 +02:00
package-lock.json Fix authenticated mobile image downloads 2026-06-09 16:02:11 +02:00
package.json Release v7.14.15 2026-07-30 17:34:39 +02:00
README.md feat: add patient education handouts 2026-05-08 22:26:53 +02:00

PedScribe Mobile App

Capacitor mobile wrapper for the hosted Ped-AI web app. The app defaults to https://app.pedshub.com, lets users choose a self-hosted server URL, and keeps clinical workflows API-backed through the same Express service as the browser app.

Features

  • Hosted web workflow inside a native WebView; server updates reach mobile clients without app-store releases
  • Configurable server URL (supports self-hosted instances)
  • Haptic feedback on recording start/stop
  • Keep screen awake during recording
  • Deep linking (pedscribe:// and https://app.pedshub.com)
  • Share intent (receive text/PDFs from other apps)
  • Push notification support
  • Biometric sign-in (Face ID / Touch ID / fingerprint) — credentials stored in iOS Keychain / Android Keystore, gated by OS biometric. Enrolled on first password sign-in (opt-in prompt). 2FA still applies on top — biometric replaces the password step only.
  • Android and iOS project scaffolds for store builds

Prerequisites

  • Node.js 18+
  • Android Studio (for Android builds): sudo snap install android-studio --classic
  • 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

# Build menu: Build > Generate Signed Bundle / APK > APK
# Sign with your keystore (create one on first build)
# APK output: android/app/build/outputs/apk/release/

# Or build from command line:
cd android && ./gradlew assembleRelease

Build iOS (macOS only)

# Open in Xcode
npx cap open ios

# In Xcode:
# 1. Select your team/signing certificate
# 2. Product > Archive
# 3. Distribute App > App Store Connect

How It Works

  1. App launches with a local launcher page
  2. First launch: user enters their PedScribe server URL (default: app.pedshub.com)
  3. URL is saved locally for future launches
  4. App navigates to the remote web app inside a native WebView
  5. Native plugins provide background recording, haptics, and push notifications

Background Recording

Android: AudioRecordingService is a foreground service that:

  • Acquires a partial wake lock (CPU stays active, screen can sleep)
  • Shows a persistent notification ("Recording in progress...")
  • Includes a "Stop Recording" quick action in the notification
  • Maximum 1-hour wake lock duration

iOS: Uses UIBackgroundModes: audio in Info.plist, which tells iOS to keep the app alive for audio capture when backgrounded or screen-locked.

Deep Linking

  • pedscribe:// custom URL scheme opens the app directly
  • https://app.pedshub.com links open in the app instead of the browser (Android App Links)

Share Intent (Android)

Other apps can share text or PDFs directly into PedScribe:

  • Share a lab result from your email into the Chart Review tab
  • Share a referral note into the Hospital Course tab

Capacitor Plugins Included

Plugin Purpose
@capacitor/app App lifecycle management
@capacitor/haptics Vibration feedback on recording start/stop
@capacitor/keyboard Keyboard management for WebView
@capacitor/push-notifications Push notification support
@capacitor/screen-orientation Screen orientation control
@capacitor/share Native share dialog
@capacitor/splash-screen Launch splash screen
@capacitor/status-bar Status bar styling

App Structure

mobile/
  capacitor.config.json    # Capacitor configuration
  package.json             # Dependencies
  src/
    index.html             # Launcher page (server URL config)
    launcher.js            # Auto-redirect + native feature init
    launcher.css            # Launcher styles
  android/                 # Android native project
    app/src/main/
      java/com/pedshub/scribe/
        MainActivity.java
        AudioRecordingService.java
      AndroidManifest.xml  # Permissions, deep links, share intent
  ios/                     # iOS native project
    App/App/
      Info.plist           # Background audio, microphone, deep links

Updating the Web App

The mobile app wraps the remote web app — updating the server automatically updates all mobile clients. No app store update needed for web changes.

To update native features (plugins, permissions, splash screen):

cd mobile
npm install
npx cap sync
# Then rebuild in Android Studio / Xcode

Generating App Icons

Replace the default Capacitor icons with PedScribe branding:

  1. Create a 1024x1024 PNG icon
  2. Install the assets tool: npm install -D @capacitor/assets
  3. Place your icon as assets/icon-only.png and assets/splash.png
  4. Run: npx capacitor-assets generate

This generates all required sizes for both platforms.

App Store Listing Suggestions

Title: PedScribe - Pediatric AI Scribe Subtitle: Voice-to-Note Clinical Documentation Category: Medical Keywords: pediatric, scribe, medical, documentation, HPI, SOAP, clinical, AI, voice

Description: PedScribe is an AI-powered clinical documentation tool for pediatric physicians. Record patient encounters, and the AI generates structured medical notes — HPIs, SOAP notes, hospital courses, chart reviews, and more. Includes pediatric calculators, developmental milestone tracking, and a learning hub with quizzes. Self-hosted for maximum privacy with HIPAA-compliant AI providers.