๐ก๏ธ NetShield - Android Firewall & Internet Blocker NetShield is a modern, open-source Android firewall that gives you complete control over which applications can access the internet. Built with Jetpack Compose and Clean Architecture, it uses Android's native VpnService to block traffic without requiring ROOT access.
Protect your privacy, save data, and improve battery life by blocking unwanted background connections.
โจ Key Features ๐ซ Granular Blocking: Block internet access for specific apps while allowing others to run freely.
๐ถ WiFi vs. Data Control: (Planned/Pro) Separate toggles to block an app only on Mobile Data or only on WiFi.
๐ Smart Search & Sort: Quickly find apps by name, installation date, or blocking status.
๐ Connection Logs: View a history of blocked connection attempts to see what your apps are doing in the background.
๐ Dark Mode Support: Fully compliant with system dark/light themes using Material 3 design.
๐ Battery Efficient: Optimized to run in the background with minimal battery drain.
๐ No Root Required: Works on all standard Android devices (Android 7.0+).
Whenever you Block or Unblock an app in the list, you must manually restart the VPN service (Toggle the main ON/OFF button on the dashboard) for the new rules to take effect.
We are working on dynamic rule updates for future versions.
๐ ๏ธ How It Works (Technical) NetShield works by creating a local "sinkhole" using the Android VpnService API.
Virtual Interface: The app creates a local VPN interface (tun0) on your device.
Traffic Routing: All outgoing network traffic from your phone is routed through this interface.
Packet Inspection:
The app inspects the UID (User ID) of every outgoing packet.
It compares this UID against your local Room Database of blocked apps.
Decision Engine:
Allowed Apps: Packets are forwarded to the actual network (WiFi/LTE) seamlessly.
Blocked Apps: Packets are dropped (filtered out) before they leave the device.
Privacy First: This process happens entirely locally on your phone. No data is ever sent to an external server.
๐๏ธ Tech Stack Language: Kotlin
UI Toolkit: Jetpack Compose (Material 3)
Architecture: MVVM (Model-View-ViewModel) + Clean Architecture
Dependency Injection: Dagger Hilt
Local Storage: Room Database
Concurrency: Coroutines & Flow
Networking: Android VpnService, ParcelFileDescriptor
๐ Getting Started Clone the repository:
Bash
git clone Open in Android Studio:
Requires Android Studio Koala or newer.
Build & Run:
Connect your device or start an emulator.
Run the app configuration.
Permissions On first launch, the app will request:
VPN Connection Request: Standard Android dialog to allow the VPN profile.
Notification Permission: Required for the foreground service to keep the VPN alive.
Query All Packages: To list all installed applications on your device.
๐ค Contribution Contributions are welcome! If you'd like to improve the packet filtering logic or add dynamic rule reloading, please fork the repository and submit a Pull Request.
Fork the Project
Create your Feature Branch (git checkout -b feature/DynamicRules)
Commit your Changes (git commit -m 'Add dynamic rule reloading')
Push to the Branch (git push origin feature/DynamicRules)
Open a Pull Request
๐ License Distributed under the MIT License. See LICENSE for more information.