Unified in-app VPN SDK's for Microsoft Windows Vista+, Android 4.4+ and Mac OS 10.7+. Earlier OS versions can be supported as well by request. Please contact [email protected] to receive your own API key.

Copyright © 2019 VPNWholesaler.com. All rights reserved.

Back

3.4 GetServlist_byCountry Android Example

I. Providing JSON as a parameter:

VPNSDK.CmdProc("{\"cmd\": 25, \"data\": {\"country\": \"DE\"}}");

Result of this command will be returned using onNotify method provided on initialization

II. Convenient form:

VPNSDK.CommandNotifyCB callback = new VPNSDK.CommandNotifyCB() {
        @Override
        public void onNotify(int notification, int error, Object data) {
            if (error == VPNSDK.OVS_ERROR_CODES.OVS_ERR_OK) {
                // Do something when command is successful
            } else {
                // Process error
            }
        }
    };
VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_GET_SERVLIST_BYCOUNTRY, callback, "DE");

This form of method accepts following parameters:

  1. Command code
  2. Callback to be invoked after command execution
  3. Country code

data parameter of callback will contain Map of the following structure:

 {
    "45.32.158.20": {
      "name": "Germany (Frankfurt #2)",
      "country": "DE",
      "hostname": "germany-frankfurt-2.vpnsr.us",
      "cipher": [
        "BF-CBC",
        "AES-128-CBC",
        "AES-128-GCM",
        "AES-256-CBC",
        "AES-256-GCM"
      ],
      "cipher_tcp_ports": [
        "1194",
        "8080",
        "8181",
        "1299",
        "1199",
        "8989",
        "8289",
        "1399",
        "9989"
      ],
      "cipher_udp_ports": [
        "1194",
        "8080",
        "8181",
        "1299",
        "1199",
        "8989",
        "8289",
        "1399",
        "9989"
      ],
      "xor": true,
      "xor_ports": [
        "443",
        "80",
        "1499",
        "9919",
        "8332",
        "30303",
        "18080",
        "8081",
        "3333"
      ],
      "non_comp_port": [
        "1600",
        "2529"
      ],
      "smart_dns_id": "4",
      "flag": "https://client-api.keenow.com/serverlist/flags/new_res/de.png",
      "protocols": {
        "l2tp": true,
        "openvpn": true,
        "ikev2": true
      },
      "lat": "50.1137",
      "lon": "8.7119",
      "distance": 1.6875546449843
    }
  }