PeekGuard is an Android application that acts as a privacy shield for your screen. It uses your device's front-facing camera to ensure you're the only one looking at your phone. If an extra face is detected, it discreetly alerts you, helping to prevent "shoulder surfing" in public spaces.
The core principle of PeekGuard is privacy first. All face detection and image processing happen entirely on your device. No data is ever stored, analyzed remotely, or transmitted off your phone.
- Real-time Face Detection: Uses the camera to count people looking at the screen in real-time.
- Customizable Alerts: Set the maximum number of faces (from 1 to many) allowed before a privacy alert is triggered.
- Background Monitoring: A persistent foreground service keeps monitoring active even when the app is in the background.
- Visual Feedback: Draws bounding boxes around detected faces directly on the in-app camera preview.
- On-Device Processing: All processing is done locally and securely on your device. Your camera feed never leaves your phone.
- System Overlay Alerts: Displays alerts on top of other applications for immediate notification.
- Modern UI: A simple, clean interface built with Material Design components, including support for a dark theme.
PeekGuard leverages modern Android libraries to deliver a robust and private experience:
- CameraX: Provides a stable and easy-to-use API to access the camera feed.
- Google's ML Kit (Face Detection): This on-device machine learning library processes the camera feed to find and count faces. It's fast, efficient, and works offline.
- Foreground Service: The monitoring runs as a foreground service, which allows it to stay active in the background and display a persistent notification, keeping the user aware that it's running.
- System Overlays: When an alert is needed, the app uses the "Display over other apps" permission to show a non-intrusive warning.
This project is built with Kotlin and leverages a suite of modern Android libraries:
- CameraX (
1.5.2): For a robust and lifecycle-aware camera implementation (camera-camera2,camera-lifecycle,camera-view). - Google ML Kit (
16.1.7): For fast, on-device face detection (face-detection). - Material Components for Android (
1.13.0): For modern UI components like sliders, switches, and dialogs. - AndroidX Lifecycle (
2.8.7): To manage background services and UI lifecycles (lifecycle-service,lifecycle-process). - AndroidX Activity (
1.12.2): For handling activity results and permissions. - AndroidX AppCompat (
1.7.1): For base app compatibility.
This is a standard Android Studio project.
- Clone this repository.
- Open the project in the latest version of Android Studio.
- Let Gradle sync the dependencies.
- Build and run the application on an emulator or a physical device.
Contributions are welcome! If you have a feature request, bug report, or want to contribute to the code, please feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
