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

2.3 CmdProc Android Example

On Android there 2 possibilities to use CmdProc method.

I. Providing JSON as a parameter:

For example for Login function we can use following code:

VPNSDK.CmdProc("{\"cmd\" : 1, \"data\" : {\"username\": \"username\", \"password\": \"password\"}}");

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

II. It's also possible to use more 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 if login is successful
                } else {
                    // Process error
                }
            }
        };
    VPNSDK.CmdProc(VPNSDK.OVS_CMD_CODES.OVS_CMD_LOGIN, callback, "username", "password")

This form of method accepts following parameters:

  1. Command code
  2. Callback to be invoked after command execution
  3. Method depending parameters

Data parameter of the result will contain HashMap object representing JSON described as a result of particular method.