Android SDK Documentation

The documentation describes the steps to integrate ActSDK into your Android Studio project.

Configure App

Configuring build.gradle

Add ActSDK.aar to your application's build.gradle file

                  compile(name:'ActSDK', ext:'aar')
Preparing AndroidManifest.xml

Add to your application's AndroidManifest.xml file

                          <action android:name="com.actmobile.actsdk.SDKVPNService" />

Make sure the necessary permissions are included

                  <uses-permission android:name="android.permission.INTERNET" />
                  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Using the SDK

Intializing the SDK

Initialize the SDK like below:

                  ActSDK actSDK = ActSDK.getInstance();
                  actSDK.initSDKwithToken(getApplicationContext(), MainActivity.this, <INSERT SDK TOKEN>);
Note: Initialization requires passing of the application context, reference to main activity, and the provided SDK Token
Important Override

The following override is necessary in your MainActivity. It is responsible for establishing the connection.

                  protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
                      if (requestCode == VPN_PREPARED && resultCode == RESULT_OK) {
                      super.onActivityResult(requestCode, resultCode, data);
Implementing the Interface

Implementing the interface is required or else the SDK will throw an error. The following callback methods are for your use:

                  void vpnInitComplete();        // called when vpn init is complete and ready to connect
                  void onVPNConnected();         // called when vpn state is connected
                  void onVPNDisconnected();      // called when vpn state is disconnected
                  void onVPNConnecting();        // called when vpn state is connecting
                  void onVPNFailed();            // called when vpn failed
                  void onVPNRetrying();          // called when vpn is retrying

Available Methods

The following are the available methods for use. You may use them as per your requirements.

Connect VPN


Disconnect VPN


Return VPN Connected State

Returns true if connected. Returns false if disconnected

Get regions list

Returns String array of regions

Get currently set region

Returns String value of currently selected region

Get the default region

Returns the value of the default region set by the SDK

Change Region for VPN

Accepts the new region name to set as VPN destination

Toggle Acceleration

Accepts boolean value to turn on/off

Get Acceleration state

Returns boolean value true/false if on/off respectively

Set Main Application Class

This is required to enable proxy mode. You must pass in the complete string name of your class. Check out the sample app for a reference.

Proxy Mode On

Turn on proxy mode

Proxy Mode Off

Turn off proxy mode

Set the Admin port.

Accepts integer value for new port number