Android port of Foqos - Focus, the physical way.
This is a functional Android translation of the iOS Foqos app. It maintains the core functionality of using NFC tags and QR codes to block distracting apps and build better digital habits.
app/
├── src/main/java/com/foqos/app/
│ ├── data/ # Room database entities and DAOs
│ │ ├── BlockedProfile.kt
│ │ ├── ProfileDao.kt
│ │ └── FoqosDatabase.kt
│ ├── strategies/ # Blocking strategies (NFC, Manual, QR, etc.)
│ │ ├── BlockingStrategy.kt
│ │ ├── ManualBlockingStrategy.kt
│ │ └── NFCBlockingStrategy.kt
│ ├── util/ # Utility classes
│ │ ├── AppBlocker.kt # Handles app blocking via UsageStatsManager
│ │ ├── NFCScanner.kt # NFC tag reading/writing
│ │ └── StrategyManager.kt # Orchestrates strategies
│ ├── ui/ # Jetpack Compose UI
│ │ ├── screens/ # Main screens
│ │ ├── components/ # Reusable UI components
│ │ └── theme/ # Material3 theme
│ ├── service/
│ │ └── BlockingService.kt # Foreground service for monitoring
│ ├── MainActivity.kt
│ └── FoqosApplication.kt
- Kotlin - Modern Android development language
- Jetpack Compose - Declarative UI (equivalent to SwiftUI)
- Room Database - Local persistence (equivalent to SwiftData)
- UsageStatsManager - App usage monitoring (partial equivalent to Family Controls)
- NFC APIs - Tag reading/writing (Android has excellent NFC support)
- ML Kit - QR code scanning
- WorkManager - Background scheduling
- Foreground Service - Persistent app monitoring
iOS uses the privileged Family Controls API which can completely prevent app launches.
Android uses UsageStatsManager + a foreground service that:
- Monitors which app is in foreground
- Detects if a blocked app is launched
- Immediately brings Foqos back to foreground with a blocking screen
Trade-offs:
- ✅ Doesn't require root or system privileges
- ✅ Works on all Android devices
⚠️ User can potentially bypass by quickly interacting with blocked app⚠️ Requires PACKAGE_USAGE_STATS permission (must be granted manually in Settings)⚠️ Foreground service runs continuously (minimal battery impact)
- PACKAGE_USAGE_STATS - Required for app blocking. User must manually enable in Settings → Special app access → Usage access
- NFC - For NFC tag features
- CAMERA - For QR code scanning
- POST_NOTIFICATIONS - For session reminders
- FOREGROUND_SERVICE - For persistent blocking
- Android Studio Hedgehog (2023.1.1) or later
- Android SDK 26+ (Android 8.0+)
- JDK 17
- Physical Android device with NFC (for NFC features)
- Clone this repository
- Open in Android Studio
- Sync Gradle
- Run on device or emulator
./gradlew buildTo test without the full permission flow:
- Use Manual blocking strategy (doesn't require special permissions)
- Grant Camera permission for QR scanning
- Grant Usage Stats permission: Settings → Apps → Special app access → Usage access → Foqos → Allow
- Core data models (Room database)
- Manual blocking strategy
- NFC blocking strategy structure
- Basic UI with Jetpack Compose
- NFC reading/writing
- Foreground service for app monitoring
- Deep link support (https://foqos.app/profile/{uuid})
- Session tracking
- Break functionality structure
- QR code scanning implementation (ML Kit integration)
- QR code generation for profiles
- Complete UI for profile creation/editing
- App selector UI (list installed apps)
- Domain/website blocking
- Scheduled profiles (WorkManager)
- Session history and statistics
- Widgets (Jetpack Glance)
- Emergency unblock UI
- Settings screen
- Export/import data
- Notification customization
- Accessibility Service for stricter blocking (requires special permission)
- Dark theme refinements
- Animations and transitions
- Widget for quick session start
- Tile for quick settings
- Localization
- App blocking is not as strict as iOS - Due to Android's security model, determined users can potentially bypass blocks
- Requires manual permission grant - PACKAGE_USAGE_STATS must be enabled in system settings
- Battery usage - Foreground service uses more battery than iOS's approach
- No Live Activities - Android doesn't have equivalent to Dynamic Island
This is a community port. Contributions welcome!
Areas that need work:
- UI/UX improvements
- Complete feature parity with iOS app
- Performance optimization
- Testing on various Android versions/devices
MIT License (same as original Foqos iOS app)
- Original iOS app by Ali Waseem
- Android port community effort
Note: This is a functional port that demonstrates the core concepts. Production use would require additional polish, testing, and potentially exploring stricter blocking mechanisms (e.g., Accessibility Service, Device Admin APIs).