# Unified VPN SDK for Android

Current version: **5.9.0**

## General

The Android SDK is part of the Pango Partner SDK, providing client-side libraries and server-side applications for implementing custom VPN infrastructure.

The SDK software is not available to be downloaded as an executable directly here. Rather, in a later step, the SDK will be added as a dependency. When you build your app, the SDK will be downloaded as a set of libraries and modules, the same way as other dependencies.

## Prerequisites

The following prerequisites are required to use the SDK:

* Android 8.0 (API Level 26) and higher (API Level 29 or higher for OpenVPN)
* An IDE for development. The pictures in the rest of the API documentation will be showing Android Studio which can be downloaded [here](https://developer.android.com/studio?gad_source=1\&gclid=CjwKCAjw3P-2BhAEEiwA3yPhwHbUDVa3V84bCLlsxXgaNu_9yy-gkzHzjh_yWsj-O097gg1zGR12YxoCoTcQAvD_BwE\&gclsrc=aw.ds).

Additionally, in order to be able to use the SDK, the following steps have to be done:

* Sign in at [pango-cloud.com](https://www.pango-cloud.com).
* Create a project and use a name for your project as a Public key. Private key is optional.
* Use SDK where `carrierId` equals given Public Key and backend url equals default SDK url or url provided by Pango team.

{% hint style="info" %}
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 us. Please contact your sales representative to initiate account creation as part of the project and client onboarding process or [contact us](https://www.pango.co/contact-us/). We apologize for any inconvenience.
{% endhint %}

## Supported Protocols

The Android SDK supports the following VPN protocols:

* Hydra
* [OpenVPN](/paas/sdk/vpn-sdk-for-android/features/openvpn-transport.md)
* [WireGuard](/paas/sdk/vpn-sdk-for-android/features/wireguard-transport.md)

## Supported Features

| Feature                                                                                                               | Description                                                                                                                                                                          |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Backend URL configuration](/paas/sdk/vpn-sdk-for-android/setup/backend-url-configuration.md)                         | The SDK supports overriding default backend API URLs by adding a new raw resource file named pango\_default\_urls.json to your project.                                              |
| [Custom SDK dependencies](/paas/sdk/vpn-sdk-for-android/features/custom-sdk-dependencies.md)                          | Allows you to override and customize parts of the VPN SDK's internal logic, such as the logger, OkHttp client, backend URL rotator, and notification builder.                        |
| [Deferred VPN service initialization](/paas/sdk/vpn-sdk-for-android/features/deferred-vpn-service-initialization.md)  | Ability to defer VPN service initialization and enable it later using PackageManager API.                                                                                            |
| [Authentication](/paas/sdk/unified-vpn-sdk/features/authentication.md)                                                | Supports Pango Auth (recommended) for managed authentication, with OAuth as an alternative for existing infrastructure.                                                              |
| [VPN interface](/paas/sdk/vpn-sdk-for-android/usage/vpn-interface.md)                                                 | Allows configuring, starting, stopping, updating, and monitoring VPN sessions, and supports useful features like transport fallback, DNS/proxy rules, and permission handling.       |
| [Backend interface](/paas/sdk/vpn-sdk-for-android/usage/backend-interface.md)                                         | Supports listing available VPN locations and countries, handling purchases and deletions, and retrieving information about the current user's remaining traffic and account details. |
| [Client Network List (CNL)](/paas/sdk/vpn-sdk-for-android/features/cnl-list.md)                                       | Supports automatically starting and stopping VPN sessions based on a configurable client network list (CNL).                                                                         |
| [Traffic rules](/paas/sdk/vpn-sdk-for-android/features/traffic-rules.md)                                              | Configure domain-based and IP-based traffic rules to control DNS resolution and routing of traffic through Hydra VPN using the addDnsRule and addProxyRule methods.                  |
| [VPN node DNS](/paas/sdk/vpn-sdk-for-android/features/vpn-node-dns-configuration.md)                                  | Supports changing the DNS server used on the VPN node to resolve DNS requests.                                                                                                       |
| [Location profile (Hydra only)](/paas/sdk/vpn-sdk-for-android/features/hydra-protocol/location-profile-hydra-only.md) | Supports custom location profiles for VPN sessions.                                                                                                                                  |
| [Proxy connection (Hydra only)](/paas/sdk/vpn-sdk-for-android/features/multihop.md)                                   | Provides the ability to connect to a desired location through another location as a proxy.                                                                                           |
| [Optimal Location](/paas/sdk/vpn-sdk-for-android/features/optimal-location-and-specific-locations.md)                 | Automatically select the best VPN server for your connection.                                                                                                                        |
| [OpenVPN transport](/paas/sdk/vpn-sdk-for-android/features/openvpn-transport.md)                                      | Supports adding OpenVPN transport to enable VPN connections over TCP.                                                                                                                |
| [WireGuard transport](/paas/sdk/vpn-sdk-for-android/features/wireguard-transport.md)                                  | Allows apps to enable fast and secure VPN connections on Android devices using the Wireguard protocol.                                                                               |
| [Reconnection strategy](/paas/sdk/vpn-sdk-for-android/features/reconnection-strategy.md)                              | Automatically handles network reconnection when switching between networks.                                                                                                          |

## Setting up a project in Android Studio

### Configuring Android Studio

Step 1. After downloading Android Studio, select ‘New Project’

<figure><img src="https://lh7-rt.googleusercontent.com/slidesz/AGV_vUe11ipcNkK6Zhtdmfk9npd9HG0xwRaJuA5SCcujSzxs4kS8MVHyP_pnJ51bZ4MeJ9aTjXrTQKWcsiAklY8Qcev9X7G6ujUFsX1HQHzxcAF1ZHeLAsLpaxR9vb_HSKZBA1fJpxTn=s2048?key=HfOILv6a-FvJfSuipFBUMMIs" alt=""><figcaption></figcaption></figure>

Step 2. Choose the template that is most appropriate for your application. This guide will follow the ‘Empty Activity’ template as seen in the corresponding picture.

<figure><img src="/files/pM73B95DzqmCD3HSO5Fj" alt=""><figcaption></figcaption></figure>

Step 3. Create a name for your project

<figure><img src="/files/DKk6wAuvIOn5PQ2HU9YO" alt=""><figcaption></figcaption></figure>

Step 4. Select the minimum SDK requirements for your project. Our SDK is compatible with API 26 (Oreo; Android 8.0) and newer. For the sake of this walkthrough, we will be selecting API 26.

Click ‘Finish’ after all your selections have been made

<figure><img src="/files/nhW6S65lWmZc23bLrOU4" alt=""><figcaption></figcaption></figure>

Step 5. The following screen will be a install screen. The installation is relatively quick. The associated picture to this step shows the screen after the install is complete.

Click ‘Finish’

<figure><img src="/files/b7kAid49uIrlzM11Mu6x" alt=""><figcaption></figcaption></figure>

Step 6. You will be taken to a page in Android Studio that looks like this

<figure><img src="/files/39My4462DPrjboLdtKxE" alt=""><figcaption></figcaption></figure>

Step 7. You will be taken to a page within Android Studio that looks like this

<figure><img src="/files/x6nLQ6VbmG2vso68023C" alt=""><figcaption></figcaption></figure>

### Configuring the SDK Dependency

Add dependencies in `build.gradle` of your app module. Version name is available at the top of this document.

```groovy
dependencies {
    implementation 'co.pango:sdk:{VERSION_NAME}'
}
```

**Step 1**. In the left hand menu select the tab `build.gradle.kts (Module :app)` which is nested under the `Gradle Scripts` folder.

<figure><img src="/files/G9wuxIR1qb7EdsIbmLk7" alt=""><figcaption></figcaption></figure>

Step 2. Once in the `build.gradle.kts (Module :app)` file, scroll down until you see the `dependencies` list at the bottom

<figure><img src="/files/NcT6vs0SqW3bGamkYZlw" alt=""><figcaption></figcaption></figure>

Step 3. Insert the code snippet below into the dependency list.\
Be sure to include the most recent version of the SDK within that snippet which can be found at the [top of this document](#general).

```kotlin
implementation("co.pango:sdk:x.y.z")
```

<figure><img src="/files/HvxEJXOL3kULKV9zeU2M" alt=""><figcaption></figcaption></figure>

**Step 4**. Click on the Light Bulb icon that appears after entering the line of code. Then click ‘Sync Now’.

It will take a minute or longer to sync. There will be a status bar at the top letting you know that it is syncing and it will also let you know when the sync is successful.

<figure><img src="/files/pn4wyP67e0bKYopXj5aL" alt=""><figcaption></figcaption></figure>

After the Sync is complete, you will receive this message at the bottom of the Android Studio screen:

<figure><img src="/files/F8p4BGTeW8jSm5rtWXmd" alt=""><figcaption></figcaption></figure>

## Sample App

Contact your account manager to get access to the demo app.

## Version Migration

For migration between versions, check [**this**](/paas/sdk/vpn-sdk-for-android/version-migration.md)

## Versioning convention

Android SDK versioning is in format MAJOR.MINOR.PATCH and should be associated with version in Jira. [See conventioning rules](https://semver.org/).

The Android SDK provides API containing:

* Classes and methods to authorize client users
* Ability to connect to backend VPN service

## Changelog

The SDK version history and changes are documented [here](/paas/sdk/vpn-sdk-for-android/changelog.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pango.gitbook.io/paas/sdk/vpn-sdk-for-android.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
