This module provides Android app packaging for the Cognotik desktop application, adapting the core functionality for mobile devices.
The Android module creates a native Android application that:
- Runs the Cognotik web server locally on the Android device
- Provides a WebView-based interface to access all Cognotik features
- Removes desktop-specific dependencies (JavaFX, System Tray, etc.)
- Adapts file system access for Android's sandboxed environment
Adapted version of the desktop CognotikApps class that:
- Removes system tray and daemon functionality
- Uses Android's file system directories
- Provides the same web applications (chat, task planning, etc.)
- Handles port management for mobile environment
Main Android activity that:
- Starts the Cognotik service
- Displays a WebView to access the web interface
- Shows loading progress while server starts
- Handles navigation within the web application
Background service that:
- Manages the Jetty web server lifecycle
- Runs in the background to keep server available
- Handles server startup/shutdown
- Provides status callbacks to the UI
Defines:
- Required permissions (Internet, file access, etc.)
- Service and activity declarations
- App metadata and launch configuration
MainActivity (UI)
├── WebView (displays Cognotik web interface)
└── CognotikService (background server)
└── AndroidCognotikApps (adapted server logic)
├── Core modules (shared with desktop)
├── WebUI modules (shared with desktop)
└── Chat/Planning apps (shared functionality)
- System Tray Manager: Not available on Android
- Daemon Client: Not needed in mobile context
- JavaFX Dependencies: Android uses WebView instead
- Desktop-specific file associations: Android handles differently
- File System Access: Uses Android's app-specific directories
- Port Management: Uses dynamic port allocation for mobile environment
- Authentication: Simplified for single-user mobile context
- Server Lifecycle: Managed by Android Service instead of system daemon
- Core Logic: All planning and AI functionality preserved
- Web Applications: Chat, task planning, goal-oriented modes
- API Integrations: Same AI model integrations
- WebUI: Same web interface, accessed via WebView
The Android module reuses most dependencies from the desktop module but excludes:
- JavaFX components (
openjfx-*) - System-specific libraries (
batik-*for desktop icon handling)
- Android SDK 26+ (Android 8.0+)
- Kotlin Android plugin
- Android Gradle Plugin 8.1.4+
- Ensure Android SDK is installed
- Add Google repository to Gradle configuration
- Enable the android module in
settings.gradle.kts - Run:
./gradlew :android:assembleDebug
The build produces an APK that can be:
- Installed directly on Android devices
- Distributed through app stores
- Side-loaded for testing
- Install the APK on an Android device
- Launch the Cognotik app
- Wait for the server to start (shown in loading screen)
- Use the web interface through the embedded WebView
- Access all desktop features: chat, planning, goal-oriented AI assistance
- The Jetty server runs in-process within the Android app
- Memory usage is optimized for mobile devices
- Server automatically manages resources
- Server binds to localhost only for security
- Uses dynamic port allocation to avoid conflicts
- All communication stays local to the device
- Uses Android's app-specific file directories
- Data is sandboxed and secure
- Follows Android storage best practices
- Optimized for mobile CPU and memory constraints
- WebView provides efficient rendering
- Background service ensures responsive UI
- Push notifications for long-running tasks
- Integration with Android sharing system
- Voice input integration
- Offline mode capabilities
- Cloud synchronization options
This adaptation demonstrates how to:
- Port JVM-based server applications to Android
- Maintain feature parity while adapting to mobile constraints
- Reuse existing business logic across platforms
- Handle platform-specific concerns (UI, file system, networking)
The pattern used here can be applied to other desktop applications that need mobile versions while preserving core functionality.