A demo Android application showcasing how to integrate and control a WireGuard VPN tunnel on Android using Kotlin and Android’s native VpnService.
Read the full article on Medium.
This project demonstrates how to build a simple VPN client that establishes a secure connection using WireGuard protocol.
It’s ideal for learning how to implement a WireGuard VPN, test configurations, or build production-ready VPN applications.
- Start and stop WireGuard VPN tunnel from Android app
- Setup WireGuard configuration
- Monitor connection status (Connected / Disconnected)
- Built with Kotlin, MVVM architecture, and Android VPN APIs
- Lightweight and easy to extend
- Language: Kotlin
- Networking: WireGuard native implementation
- Android Components: VpnService, ViewModel
- Build System: Gradle (Kotlin DSL)
git clone https://github.com/satishnada/WireGuard-VPN-Demo.git
cd WireGuard-VPN-Demo- Open Android Studio (latest version)
- Select File → Open... and choose the cloned project folder
- Let Gradle sync dependencies automatically
- Add your WireGuard
.conffile in the app’s assets or define it directly in code - Example configuration:
[Interface] PrivateKey = <your_private_key> Address = 10.0.0.2/32 DNS = 1.1.1.1 [Peer] PublicKey = <peer_public_key> Endpoint = vpn.example.com:51820 AllowedIPs = 0.0.0.0/0, ::/0
- Make sure your VPN endpoint is reachable.
- Build and install the app on a real Android device
- Tap “Start VPN” to activate the WireGuard tunnel
- Accept the system VPN permission dialog
WireGuard-VPN-Demo/
│
├── app/
│ ├── src/main/
│ │ ├── java/com/example/wireguarddemo/
│ │ │ ├── MainActivity.kt
│ │ │ ├── WireGuardService.kt
│ │ │ └── utils/
│ │ └── res/
│ ├── AndroidManifest.xml
│ └── build.gradle.kts
│
├── gradle/
├── settings.gradle.kts
└── README.md
- Dynamic server selection
- Split tunneling and kill switch
- Real-time logs and connection analytics
- Multi-protocol support (WireGuard / OpenVPN)
- UI improvements with Compose
Contributions are welcome!
- Fork the repository
- Create your feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
This project is licensed under the Apache 2.0 License — see the LICENSE file for details.
⚡ Secure your network with WireGuard — fast, simple, and modern!
