Unified VPN SDK demo for Android
This is a demo application for Android with basic usage of Unified VPN SDK.
Last updated
This is a demo application for Android with basic usage of Unified VPN SDK.
Last updated
The following prerequisites are required to use the SDK:
Android 21+
Latest version of Android Studio (recommended)
Java Development Kit (JDK) 17
Clone app source code locally from this Github.
Launch Android Studio and navigate to the folder containing the recently downloaded project from Github. Once the project is open, you need to sync the project with the Gradle files. To do this, follow these steps:
Click on the File
menu in the top menu bar. From the dropdown menu, select Sync Project with Gradle Files
. Wait for the syncing process to complete. Android Studio will download any missing dependencies and build the project.
Click on the Run
menu in the top menu bar. From the dropdown menu, select Run 'app'
. Wait for the process to complete. It should launch Android emulator and open the demo app.
Sign in at pango-cloud.com .
Note that at this time, it is not possible for users to create their own accounts directly if they do not already have an account established with example.com. Please contact your sales representative to initiate account creation as part of the project and client onboarding process or contact us. We apologize for any inconvenience.
In Pango dashboard, create a project and use a name for your project as a Public key. Private key is optional.
5. Navigate to the Network
tab from the navigation bar. Then, click on the Add location
button.
6. In Pango dashboard, navigate to the dashboard and locate your project_id
. Open the demo app in Android Studio and enter the project_id
in the Carrier field.
Please note that while the application is titled "Hydra SDK Demo", it actually demonstrates the functionality of the Unified SDK.
7. You are ready to connect to the VPN. To initiate the VPN connection process in the demo app:
Click the "init" button. No visible change will occur, which is expected behavior.
Click the "LOGIN" button. The app should now display a "Logged in" message, indicating successful authentication.
Click the "Connect" button. The app will establish the VPN connection, and display a "Connected" message upon success.
Your device is now connected to the VPN. To verify the connection:
Open the Chrome browser on your Android device.
Navigate to whatsmyip.com.
Observe that the IP address displayed is different from your device's actual IP address, confirming that traffic is being routed through the VPN.
To terminate the VPN connection when finished, click the "DISCONNECT" button in the demo app. This will sever the connection and restore direct network access.
The VPN SDK allows you to route network traffic through a VPN connection. By default, all internet traffic will use the VPN when the VPN is active. However, the SDK provides the ability to exclude specific domains from using the VPN connection.
In the example app, the domain ip.me is hardcoded to bypass the VPN and use the device's actual IP address. This is done to demonstrate how to configure the SDK to exclude certain domains from the VPN tunnel. The exclusion logic is implemented in the app's code, not the SDK itself. SDK users have the flexibility to specify any domains they wish to exclude from the VPN.
If you want ip.me to also use the VPN connection, simply comment out the line in the app code that excludes this domain. After relaunching the app, ip.me will then route its traffic through the VPN like all other domains.
This is due to the multi-layered infrastructure of the VPN. Here is a simplified overview of how the IP addresses work in a typical VPN setup:
(client) -> <connect IP> -> (VPN server) -> <out IP> -> (website)
The client (your device) connects to the VPN server using the server's connect IP address. This is the current_server IP that is visible to you.
The VPN server then sends your web requests out to the internet using a different IP address, known as the out IP.
When the requested website receives the web request, it sees the out IP of the VPN server, not the original IP of your client device.
In summary, the client sees the connect IP of the VPN server it is connected to, while the end website sees the out IP that the VPN server uses to relay the web requests. These two IP addresses are intentionally different in the VPN infrastructure.
For more detailed information, please refer to SDK documentation.