Search code examples
javavpnandroid-vpn-service

When the VPN is connected, user will be able to enter the app and if they are not connected, they will not be able to enter. How do I do that?


I have seen in many apps that when VPN is connected you can get inside the app and if you are not connected you can't get in. How can I do this with Java programming?


Solution

  • Write your program like it would access any other local network resource. Once the user connects to the VPN, the network resource will become available and is handled further down the stack. No need to account for a VPN programmatically in your application.