Android_IP_Cam is an Android application that transforms Android devices into fully-functional IP cameras with HTTP streaming capabilities. The application is designed for 24/7 surveillance operations, repurposing older Android devices into reliable, network-accessible camera systems compatible with professional surveillance software.
📖 BUILD_GUIDE.md - Step-by-step guide for building with Android Studio
🏗️ ARCHITECTURE.md - Detailed code structure and architecture explanation
🚀 ANDROID_STUDIO_SETUP.md - Quick reference for Android Studio run/debug setup
⚡ QUICK_START.md - Get up and running in 5 minutes
📡 API_DOCUMENTATION.md - Complete API reference
🤝 CONTRIBUTING.md - Development guidelines
- Live Camera Preview: View what the camera sees directly in the app
- HTTP Web Server: Access the camera through any web browser
- MJPEG Streaming: Real-time video streaming compatible with surveillance systems
- Multiple Concurrent Connections: Supports 32+ simultaneous clients (streams, status checks, snapshots)
- Real-time Updates: Server-Sent Events (SSE) for live connection monitoring
- Camera Selection: Switch between front and back cameras
- Flashlight/Torch Control: Toggle flashlight for back camera (in-app and via HTTP API)
- Configurable Formats: Choose supported resolutions from the web UI
- Orientation Control: Independent camera orientation (landscape/portrait) and rotation (0°, 90°, 180°, 270°)
- Persistent Service: Foreground service with automatic restart and battery optimization
- Network Monitoring: Automatically restarts server on network changes
- Settings Persistence: All settings saved and restored across app restarts
- REST API: Simple API for integration with other systems
- Low Latency: Optimized for fast streaming with JPEG compression
- Android Version: Android 7.0 (API 24) or higher
- Target Version: Android 14 (API 34)
- Hardware: Device with camera (front or back)
- Network: WiFi connection for streaming
- Android Version: Android 12 (API 31) or higher for best compatibility
- Hardware: Device with at least 2GB RAM
- Network: Stable WiFi connection
- Android Studio Ladybug (2024.2.1) or later
- Android SDK with API 34
- Gradle 8.11 or later
- JDK 17 or later (JDK 21 recommended for future-proofing)
For detailed instructions with screenshots, see BUILD_GUIDE.md
-
Clone the repository:
git clone https://github.com/tobi01001/Android_IP_Cam.git cd Android_IP_Cam -
Open in Android Studio:
- Launch Android Studio
- Select "Open an Existing Project"
- Navigate to the cloned repository folder
- Click "OK" and wait for Gradle sync
-
Build the APK:
./gradlew assembleRelease
The APK will be generated at:
app/build/outputs/apk/release/app-release-unsigned.apk -
Install on device:
adb install app/build/outputs/apk/release/app-release-unsigned.apk
Download the latest APK from the Releases page and install it on your Android device.
- Launch the app on your Android device
- Grant permissions:
- Camera permission (required)
- Notification permission (Android 13+)
- Battery optimization exemption (recommended for 24/7 operation)
- Start streaming by tapping the "Start Streaming" button
- Note the server URL displayed in the app (e.g.,
http://192.168.1.100:8080)
Open the server URL in any web browser:
http://DEVICE_IP:8080
You'll see a live stream with controls for:
- Camera switching
- Flashlight toggle
- Taking snapshots
- Real-time connection monitoring
Configure your NVR/VMS software with:
- Stream URL:
http://DEVICE_IP:8080/stream - Snapshot URL:
http://DEVICE_IP:8080/snapshot - Format: MJPEG
vlc http://DEVICE_IP:8080/stream| Endpoint | Method | Description | Response Type |
|---|---|---|---|
/stream |
GET | MJPEG video stream | multipart/x-mixed-replace |
/snapshot |
GET | Single JPEG image | image/jpeg |
/status |
GET | System status | application/json |
| Endpoint | Method | Description | Response Type |
|---|---|---|---|
/ |
GET | Web interface | text/html |
/switch |
GET | Switch camera | application/json |
/toggleFlashlight |
GET | Toggle flashlight | application/json |
/setRotation?value=X |
GET | Set rotation (0/90/180/270/auto) | application/json |
/setFormat?value=WxH |
GET | Set resolution | application/json |
/events |
GET | Server-Sent Events stream | text/event-stream |
# Get system status
curl http://192.168.1.100:8080/status
# Take a snapshot
curl http://192.168.1.100:8080/snapshot -o snapshot.jpg
# Switch camera
curl http://192.168.1.100:8080/switch
# Toggle flashlight
curl http://192.168.1.100:8080/toggleFlashlight
# Set rotation to 90 degrees
curl "http://192.168.1.100:8080/setRotation?value=90"Source Type: Remote
Remote Method: HTTP
Remote Host Path: DEVICE_IP:8080/stream
Input Type: H.264/MJPEG
Connection URL: http://DEVICE_IP:8080/stream
Network IP Camera
Make: Generic MJPEG
Path: /stream
Camera Type: Network Camera
URL: http://DEVICE_IP:8080/stream
All settings are automatically saved and restored:
- Camera type (front/back)
- Rotation angle
- Resolution
- JPEG quality
- Server port
- Flashlight state
- Auto-start on boot
Edit StreamingConfig.kt to customize:
- JPEG Quality: Default 80% (range: 70-85%)
- Target FPS: Default 10 fps
- Server Port: Default 8080
- Max Connections: Default 32
- CameraService: Foreground service managing camera lifecycle
- IPCamWebServer: NanoHTTPD-based HTTP server
- MainActivity: Main UI with camera preview and controls
- NetworkMonitor: WiFi connectivity monitoring
- StreamingConfig: Settings persistence manager
- Single Source of Truth: CameraService manages ONE camera instance for all consumers
- 24/7 Reliability: Foreground service with wake locks and watchdog monitoring
- Bandwidth Optimization: ~10 fps, 80% JPEG quality for optimal network usage
- NVR Compatibility: Standard MJPEG stream format
- Check camera permissions
- Ensure no other app is using the camera
- Restart the device
- Verify device and client are on same network
- Check firewall settings
- Ensure server is running (check notification)
- Enable battery optimization exemption
- Check WiFi stability
- Verify device is not entering deep sleep
- Reduce JPEG quality (70-80%)
- Lower target FPS (5-10 fps)
- Check network bandwidth
Android_IP_Cam/
├── app/
│ ├── src/main/
│ │ ├── java/com/example/ipcam/
│ │ │ ├── CameraService.kt # Core camera management
│ │ │ ├── IPCamWebServer.kt # HTTP server
│ │ │ ├── MainActivity.kt # Main UI
│ │ │ ├── NetworkMonitor.kt # Network monitoring
│ │ │ ├── StreamingConfig.kt # Settings management
│ │ │ └── BootReceiver.kt # Auto-start on boot
│ │ ├── res/
│ │ │ ├── layout/
│ │ │ │ └── activity_main.xml # Main activity layout
│ │ │ └── values/
│ │ │ ├── strings.xml
│ │ │ ├── colors.xml
│ │ │ └── themes.xml
│ │ └── AndroidManifest.xml
│ └── build.gradle.kts
├── build.gradle.kts
├── settings.gradle.kts
├── REQUIREMENTS_SPECIFICATION.md
└── README.md
- CameraX: 1.3.1 - Modern camera API
- NanoHTTPD: 2.3.1 - Embedded HTTP server
- Kotlin Coroutines: 1.7.3 - Async operations
- Material Components: 1.11.0 - UI components
# Debug build
./gradlew assembleDebug
# Release build
./gradlew assembleRelease
# Run tests
./gradlew test
# Install on connected device
./gradlew installDebug- BUILD_GUIDE.md - Step-by-step Android Studio build instructions (with troubleshooting)
- ARCHITECTURE.md - Complete code structure and architecture explanation
- CONTRIBUTING.md - Development workflow and guidelines
- QUICK_START.md - Get started in 5 minutes
- API_DOCUMENTATION.md - Complete API reference with examples
- REQUIREMENTS_SPECIFICATION.md - Complete technical requirements (125+ requirements)
- REQUIREMENTS_SUMMARY.md - Quick reference guide
- IMPLEMENTATION_VALIDATION.md - Compliance verification report
- CHANGELOG.md - Version history
Developed and tested for Samsung Galaxy S10+ (but should work on any Android device with camera and Android 7.0+)
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues, questions, or suggestions, please open an issue on GitHub.
- Built with CameraX for modern camera management
- Powered by NanoHTTPD for embedded HTTP server
- Compatible with industry-standard surveillance software
- Design Principles - Comprehensive guide to the five core design principles guiding all implementation decisions
- Requirements Specification - Complete technical requirements for implementing Android_IP_Cam from scratch
- Requirements Summary - Quick reference guide to the requirements specification