Fix Android support, add settings persistence, and clean up code#52
Open
Mihonarium wants to merge 3 commits intomainfrom
Open
Fix Android support, add settings persistence, and clean up code#52Mihonarium wants to merge 3 commits intomainfrom
Mihonarium wants to merge 3 commits intomainfrom
Conversation
- Fix Android crash by guarding native BackgroundHaptics module import (iOS-only native code now falls back to no-op on Android) - Add FOREGROUND_SERVICE permission for Android background audio - Persist user settings (frequency, learning mode, vibration, offset) across app restarts using AsyncStorage - Fix duplicate entries in app.json (UIBackgroundModes, UIRequiredDeviceCapabilities) - Remove redundant useEffect hooks and fix stale closure in selectFrequency - Remove broken <Text></Text> && JSX pattern - Remove unused imports (Alert, Switch) and dead code (Battery/lowPower) - Clean up whitespace and commented-out code - Add CLAUDE.md with project documentation - Update README to reflect completed TODOs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Restore setLastDir state that was incorrectly removed - Fix silent failure: background vibration on Android was a no-op (BackgroundHaptics falls back to no-op on Android); now uses Vibration.vibrate(100) directly when in background on Android - Fix Android audio mode: change DoNotMix to DuckOthers so compass cues don't kill other apps' audio (matches iOS MixWithOthers intent) - Set shouldDuckAndroid: true so compass audio gracefully yields when other apps need audio focus - Add type guard in loadSettings for corrupted AsyncStorage data - Add Platform import for platform-specific vibration handling - Document Android background audio limitation honestly in README and CLAUDE.md (expo-av lacks foreground service, OS may kill audio after 1-3 min) - Shorten fallback vibration from 200ms to 100ms for crisper feel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create android-foreground-service Expo native module with: - Kotlin ForegroundService (mediaPlayback type) with persistent notification - Expo Modules API bridge exposing startService/stopService/updateNotification - Config plugin injecting service declaration and permissions into AndroidManifest - JS bridge with iOS no-op stubs This prevents Android from killing the app under Doze mode, making background audio and vibration work indefinitely instead of stopping after 1-3 minutes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Android Foreground Service (new)
android-foreground-serviceExpo native module with a KotlinForegroundServiceusingmediaPlaybacktypeFOREGROUND_SERVICE_MEDIA_PLAYBACK+POST_NOTIFICATIONSpermissions into AndroidManifest.xmlPrevious fixes (still in this PR)
DoNotMixtoDuckOthersso the app doesn't kill other apps' audioArchitecture
Test plan
🤖 Generated with Claude Code