API | Description |
getInstance | Get the MpAccClient singleton instance |
setDataKey | Set Device secret key |
setSign | Set application signature authentication |
setRegionalAccess | Set whether to use region-based access point assignment |
setConnectTimeout | Sets connection timeout. |
setLogInfoCallback | Set the log information callback interface |
setLogLevel | Set the log level |
prepare | Obtain the VPN authentication Intent |
updateTCPDirect | Dynamically update TCP direct-connection status |
updateUDPDirect | Dynamically update UDP direct-connection status |
startAcc | Start acceleration |
stopAcc | Stop acceleration |
startMeasure | Enable network measurement |
stopMeasure | Stop network measurement |
registerAccCallback | Register a callback to listen for acceleration status |
unregisterAccCallback | Unregister the callback to listen for acceleration status |
registerMeasureCallback | Register a callback to listen for network measurement results |
unregisterMeasureCallback | Unregister the callback to listen for network measurement results |
requestNetwork | Request network |
releaseNetwork | Release network |
register | Pre-register |
getSdkVersion | Obtaining the SDK Version Number |
public static MpAccClient getInstance(Context context)
Parameter | Type | Description |
context | Context | ApplicationContext |
public static void setDataKey(String uuid, String dataKey)
Parameter | Type | Description |
uuid | String | Unique device identifier (can reuse the deviceId returned by the cloud API) |
dataKey | String | Device key (each dataKey corresponds to one device and cannot be reused) |
public static void setSign(String appId, String sign)
Parameter | Type | Description |
appId | String | Application appId |
sign | String | Signature string |
public static void setRegionalAccess(boolean isRegionalAccess)
Parameter | Type | Description |
isRegionalAccess | boolean | Whether to use region-based access point assignment true: Yes false: No Default: true |
public static void setConnectTimeout(long timeout)
Parameter | Type | Description |
timeout | long | Timeout (seconds) |
public static void setLogInfoCallback(LogInfoCallback logInfoCallback)
Parameter | Type | Description |
logInfoCallback | LogInfoCallback | log callback instance |
public static void setLogLevel(int level, boolean enablePrint)
Parameter | Type | Description |
level | int | Log level (0-6) 0:PANIC 1:FATAL 2:ERROR 3:WARN 4:Info 5:DEBUG 6:TRACE |
enablePrint | boolean | Whether to print logs |
public static Intent prepare(Activity activity)
Parameter | Type | Description |
activity | Activity | Current activity |
public void startAcc(AccConfig accConfig)
Parameter | Type | Description |
accConfig | AccConfig | Acceleration configuration object |
public boolean stopAcc()
public void startMeasure(MeasureConfig measureConfig)
Parameter | Type | Description |
measureConfig | MeasureConfig | Network measurement configuration object |
public void stopMeasure()
public void registerAccCallback(AccCallback accCallback)
Parameter | Type | Description |
accCallback | AccCallback | Acceleration status callback object |
public void unregisterAccCallback(AccCallback accCallback)
Parameter | Type | Description |
accCallback | AccCallback | Acceleration status callback object |
public void registerMeasureCallback(MeasureCallback measureCallback)
Parameter | Type | Description |
measureCallback | MeasureCallback | Network measurement callback object |
public void unregisterMeasureCallback(MeasureCallback measureCallback)
Parameter | Type | Description |
measureCallback | MeasureCallback | Network measurement callback object |
public void requestNetwork(int type)
Parameter | Type | Description |
type | int | Network Type Cellular 1:Wi-Fi |
public void releaseNetwork(int type)
Parameter | Type | Description |
type | int | Network Type Cellular 1:Wi-Fi |
public void register(boolean isActivateCellular, int mode,RegisterCallback registerCallback)
Parameter | Type | Description |
isActivateCellular | boolean | Whether to activate cellular. Activating cellular in advance under weak Wi-Fi conditions can reduce acceleration time and improve connection establishment success rate, but it also increases power consumption on the terminal device. |
mode | int | Acceleration mode |
registerCallback | RegisterCallback | Pre-registration callback object |
public String getSdkVersion()
void onLogInfoUpdate(String tag, String msg)
API | Description |
tag | Tag |
msg | Message |
API | Description |
onRegisterSuccess | Registration succeeded |
onRegisterFail | Registration failed |
void onRegisterSuccess()
void onRegisterFail(int code)
Parameter | Type | Description |
code | int | Error code. Refer to the error code module. |
mode | int | Mode 0: capturing all packets; 1: capturing specific IP address packets (not supported yet) |
API | Description |
setBlackList | Sets the blocklist applications. |
setWhiteList | Sets the allowlist applications. |
setAccMode | Sets the acceleration mode. |
addAccNode | Adds acceleration nodes. |
setPingInterval | Sets the callback interval. |
setRoute | Sets the routing table. |
setAccLinks | Sets the acceleration links. |
setPriority | Sets the link priority. |
setTCPDirect | Sets tcp direct connection. |
setUDPDirect | Sets UDP direct connection. |
setAllowBypass | Sets the bound NIC direct connection. |
setVpnKeepAlive | Sets whether to keep the acceleration alive. |
addNetworkPlugin | Inserts a custom network interface card. |
setInt | Sets the int-type configuration parameters. |
setString | Sets the String-type configuration parameters. |
setBoolean | Sets the boolean-type configuration parameters. |
setArrayList | Sets the ArrayList configuration parameters. |
setEnableSocks | Sets whether to enable the socks proxy. |
setSocksPort | Sets the socks proxy port number. |
setSocksUsername | Sets the socks username. |
setSocksPassword | Sets the socks password. |
setEncryption | Sets whether to enable encryption. |
setCongestionMode | Sets the congestion algorithm. |
setNetworkConditions | Sets the conditions for network acceleration. |
setStartForeground | Whether to start the foreground service. |
public AccConfig setBlackList(ArrayList<String> apps)
Parameter | Type | Description |
apps | ArrayList<String> | List of application package names that do not require acceleration |
ArrayList<String> blackList = new ArrayList<>();blackList.add("com.example.app1");accConfig.setBlackList(blackList);
public AccConfig setWhiteList(ArrayList<String> apps, int mode)
Parameter | Type | Description |
apps | ArrayList<String> | List of application package names that require acceleration |
mode | int | Mode 0: capturing all packets; 1: capturing specific IP packets (not supported yet) |
public AccConfig setAccMode(int mode)
Parameter | Type | Description |
mode | int | Acceleration mode AccConfig.ACC_MOD_BONDING Aggregation (applicable to video streaming scenarios) AccConfig.ACC_MOD_REDUNDANT Redundancy (applicable to gaming scenarios) AccConfig.ACC_MOD_FASTSWITCHING Fast switching (applicable to meeting and cloud gaming scenarios) |
public AccConfig addAccNode(String ip, int port)
Parameter | Type | Description |
ip | String | Acceleration node IP address |
port | int | Acceleration node port number |
public AccConfig setPingInterval(int interval)
Parameter | Type | Description |
interval | int | Interval, unit: seconds |
public AccConfig setRoute(String address, int prefixLength)
Parameter | Type | Description |
address | String | IP address |
prefixLength | int | Subnet mask network bit length |
public AccConfig setAccLinks(int links)
Parameter | Type | Description |
links | int | Acceleration link information Cellular link: AccConfig.MOBILE_LINK Wi-Fi link: AccConfig.WIFI_LINK Ethernet link: AccConfig.ETH_LINK Cellular + Wi-Fi: The SDK uses AccConfig.WIFI_LINK|AccConfig.MOBILE_LINK by default. |
public AccConfig setPriority(HashMap<Integer, Integer> priority
Parameter | Type | Description |
priority | HashMap | Priority map key: link type 0: mobile 1: Wi-Fi 9: eth value: a number ranging from 0-255, where a lower number indicates a higher priority. The default value is 64. When the priority number is >= 128, it indicates that the link is a backup link. priority.put(0,64) sets the priority of the link with type=0 (mobile) to 64. |
public AccConfig setUDPDirect(boolean udpDirect)
Parameter | Type | Description |
udpDirect | boolean | udp direct connection true: Direct connection false: No direct connection Enables direct connection for this interface. After acceleration, all udp traffic will be sent directly to the business server via the default route. |
public AccConfig setTCPDirect(boolean tcpDirect)
Parameter | Type | Description |
tcpDirect | boolean | tcp direct connection true: Direct connection false: No direct connection Enables direct connection for this interface. After acceleration, all tcp traffic will be sent directly to the business server via the default route. |
public AccConfig setAllowBypass(boolean allowBypass)
Parameter | Type | Description |
allowBypass | boolean | tcp direct connection true: Direct connection false: No direct connection. The default value is false. In VPN mode, enabling direct connection for this interface causes traffic from the specified network card to bypass VPN interception. |
public void addNetworkPlugin(String pluginClassName)
Parameter | Type | Description |
pluginClassName | String | Full class name of the NIC plugin (Refer to FAQ Q4 for details). |
public AccConfig setInt(String key, String value)
Parameter | Type | Description |
key | String | Configuration name, key value: AccConfig.KEY_MAX_RTT_DISABLE_AGGREGATION In aggregation mode, links exceeding this value are not included in the aggregation. It is generally not recommended for users to modify this value. AccConfig.KEY_MAX_DELAY_UNTIL_FAILED In real-time mode, this is the threshold for determining available links. Links exceeding this value are considered faulty and will not be used until they recover. It is generally not recommended for users to modify this value. AccConfig.KEY_MIN_SWITCH_RTT In real-time mode, this is the switching sensitivity. It is generally not recommended for users to modify this value. AccConfig.KEY_MAX_RTT_THRESHOLD In aggregation and real-time modes, this is the threshold for enabling link fault detection. Links exceeding this value undergo fault detection. It is generally not recommended for users to modify this value. AccConfig.KEY_MAX_RETRY_TIMES Setting the number of Quic connection establishment retries, with a default of 3. |
value | String | Value |
public AccConfig setString(String key, String value)
Parameter | Type | Description |
key | String | Configuration name, key value: AccConfig.KEY_SERVER_DOMAIN: Configure domain name AccConfig.KEY_SECRET_KEY_ID: Secret key ID AccConfig.KEY_CIPHER_TEXT: Signature string AccConfig.KEY_SIGNATURE: Digital signature AccConfig.KEY_T2_OUT: Specify T2 segment acceleration drop-off point Currently supported egress points: frankfurt siliconvalley saopaulo tokyo bangkok singapore hongkong If Hong Kong (China) is specified as the egress point: accConfig.setBoolean(AccConfig.KEY_ENABLE_T2_ACC, true); accConfig.setString(AccConfig.KEY_T2_OUT, "hongkong"); |
value | String | Value |
public AccConfig setBoolean(String key, boolean value)
Parameter | Type | Description |
key | String | Value for the configuration name key: AccConfig.KEY_ENABLE_T2_ACC: Enable T2 segment acceleration AccConfig.KEY_ALLOW_PRIVATE_NETWORK: Private network interconnection |
value | String | Value |
public AccConfig setArrayList(String key, ArrayList<String> value)
Parameter | Type | Description |
key | String | Value for the configuration name key: AccConfig.KEY_APP_ID_LIST AppId list. Pass in the appId of the corresponding application, and the SDK will accelerate the application's allowlist domains in the T2 segment. |
value | ArrayList | Value |
public AccConfig setEnableSocks(boolean enableSocks)
Parameter | Type | Description |
enableSocks | boolean | Whether to enable the socks proxy: true: Enable false: Disable Default: false |
public AccConfig setSocksPort(int socksPort)
Parameter | Type | Description |
socksPort | int | Sets the socks proxy port number. |
public AccConfig setSocksUsername(String socksUsername)
Parameter | Type | Description |
socksUsername | String | socks username |
public AccConfig setSocksPassword(String socksPassword)
Parameter | Type | Description |
socksPassword | String | socks password |
public AccConfig setEncryption(boolean encryption)
Parameter | Type | Description |
encryption | boolean | Whether the packet is encrypted: true: Encrypt false: Do not encrypt |
public AccConfig setCongestionMode(int congestionMode)
Parameter | Type | Description |
congestionMode | int | Congestion algorithm parameter: 0: BBR 1: CUBIC 2: BBR-NORMAL Default value: 0 |
public AccConfig setNetworkConditions(int conditions)
Parameter | Type | Description |
conditions | int | AccConfig.MUST_WIFI_ACTIVE: The current terminal must have Wi-Fi activated. AccConfig.MUST_SIM_CARD_READY: The current terminal must have a SIM card inserted. AccConfig.MUST_MOBILE_DATA_ENABLE: The current terminal must have mobile data enabled. If you need to add multiple conditions, set them as follows: AccConfig.MUST_WIFI_ACTIVE|AccConfig.MUST_SIM_CARD_READY |
public AccConfig setStartForeground(boolean startForeground)
Parameter | Type | Description |
startForeground | boolean | false: Do not pull up true: Pull up Default: true |
API | Description |
setRTT | Sets the latency threshold. |
setLoss | Sets the packet loss rate threshold. |
setJitter | Sets the jitter threshold. |
setAddr | Sets the speed test address. |
setMode | Sets the mode. |
setTime | Sets the sliding window measurement time. |
setQuickTime | Sets the quick start window time. |
setQuickRtt | Sets the quick start latency threshold. |
setInterval | Sets the measurement callback frequency. |
setPingTimeout | Sets the ping packet timeout. |
setT2AccProbeAddr | Sets the T2 segment speed test IP address. |
setDisableSlaveLossDetect | Disables slave path packet loss detection. |
setAdditionalOptions | Sets the fallback origin custom options. |
setStartForeground | Starts the foreground service. |
public MeasureConfig setRTT(int RTT)
Parameter | Type | Description |
RTT | int | Latency threshold (ms) |
public MeasureConfig setLoss(int loss)
Parameter | Type | Description |
loss | int | Packet loss percentage threshold (0-100) |
public MeasureConfig setJitter(int jitter)
Parameter | Type | Description |
jitter | int | Network jitter threshold (ms) |
public MeasureConfig setJitter(int jitter)
Parameter | Type | Description |
mode | int | Modes are as follows: Aggregation: AccConfig.ACC_MOD_BONDING Dual-send: AccConfig.ACC_MOD_REDUNDANT Fast switching: AccConfig.ACC_MOD_FASTSWITCHING |
public MeasureConfig setTime(int time)
Parameter | Type | Description |
time | int | Measurement duration, in ms |
public MeasureConfig setQuickRtt(int quickRtt)
Parameter | Type | Description |
quickRtt | int | Quick start latency threshold, unit: ms |
public MeasureConfig setQuickTime(int quickTime)
Parameter | Type | Description |
quickTime | int | Quick start window time, unit: ms |
public MeasureConfig setInterval(int interval)
Parameter | Type | Description |
interval | int | Callback frequency, in ms |
public MeasureConfig setPingTimeout(int pingTimeout)
Parameter | Type | Description |
pingTimeout | int | Timeout, unit: ms |
public MeasureConfig setT2AccProbeAddr(String addr)
Parameter | Type | Description |
addr | String | T2 speed test IP. Europe server: MeasureConfig.FRANKFURT_ADDRESS US server: MeasureConfig.SILICON_VALLEY_ADDRESS Brazil server: MeasureConfig.SAO_PAULO_ADDRESS Japan server: MeasureConfig.TOKYO_ADDRESS Thailand server: MeasureConfig.BANGKOK_ADDRESS Singapore server: MeasureConfig.SINGAPORE_ADDRESS Hong Kong (China): MeasureConfig.HONG_KONG_ADDRESS |
public MeasureConfig setDisableSlaveLossDetect(boolean disableSlaveLossDetect)
Parameter | Type | Description |
disableSlaveLossDetect | boolean | true: Disable false: Do not disable |
public MeasureConfig setAdditionalOptions(AdditionalOptions additionalOptions)
Parameter | Type | Description |
additionalOptions | AdditionalOptions | Fallback origin custom object |
public MeasureConfig setStartForeground(boolean startForeground)
Parameter | Type | Description |
startForeground | boolean | false: Do not pull up true: Pull up Default: true |
API | Description |
onAccDataUpdate | Network speed callback |
onSummaryInfoUpdate | Acceleration summary information update |
onNetworkStateChanged | Network adapter link state change callback |
onAccSuccess | Acceleration success callback |
onAccFail | Acceleration failure callback |
void onAccDataUpdate(long tRx, long tTx, ArrayList<PathDetail> pathDetails)
Parameter | Type | Description |
tRx | long | Total received data volume (bytes) |
tTx | long | Total transmitted data volume (bytes) |
pathDetails | ArrayList | Detailed data for each transmission path |
void onSummaryInfoUpdate(String summaryInfo)
Parameter | Type | Description |
summaryInfo | String | Acceleration summary information, which is JSON-formatted summary data containing key metrics such as network quality and acceleration effectiveness. |
void onNetworkStateChanged(int type, boolean available, String ip)
Parameter | Type | Description |
type | int | NIC type 0:mobile 1:Wi-Fi |
available | boolean | Available or not |
ip | String | NIC ip address (IPv4), left blank if unavailable. |
void onAccSuccess(ArrayList<String> packageNames, String ip, int port)
Parameter | Type | Description |
packageNames | ArrayList | List of successfully accelerated application package names |
ip | String | Acceleration server IP address |
port | int | Acceleration server port |
void onAccFail(ArrayList<String> packageNames, int errorCode)
Parameter | Type | Description |
packageNames | ArrayList | List of application package names for which acceleration failed |
errorCode | int | Error code (see the error code table for details) |
API | Description |
onStartMpAcc | Enable acceleration (recommended) |
onStopMpAcc | Disable acceleration (recommended) |
onStartQos | Enable Qos (recommended) |
onNoPolicy | No policy is available for the current network state. |
onAccException | The acceleration link is abnormal. |
onRttChanged | Callback for bypass udping rtt latency |
onAccStateChanged | Acceleration state change callback |
onDetectServerUpdate | Callback for speed test ip change |
void onStartMpAcc(int code)
Parameter | Type | Description |
code | int | trigger code 1: Latency Exception Trigger 2: Packet Loss Rate Exception Trigger 3: Jitter exception trigger |
void onStopMpAcc(int code)
Parameter | Type | Description |
code | int | trigger code 1: Single NIC Trigger 2: No Optimization Trigger 3: No Network Trigger |
void onStartQos(int code)
Parameter | Type | Description |
code | int | trigger code 1: Latency Exception Trigger 2: Packet Loss Rate Exception Trigger 3: Jitter exception trigger |
void onNoPolicy(int code)
Parameter | Type | Description |
code | int | Trigger code 2: Single Wi-Fi 3: No network available 4: Internal Error 5: Speed test service abnormally disconnected -12: Authentication timeout -13: Authentication Exception -19: Speed test service failure -23: Account authentication failed. |
void onAccException(int errorCode)
Parameter | Type | Description |
errorCode | int | Error Code -6: acc speed test sustained packet loss exception. -7: acc speed test maximum latency exception. -8: acc speed test latency anomaly compared to default route. -9: acc speed test average latency exceeds maximum threshold. |
void onRttChanged(int type, int rtt)
Parameter | Type | Description |
type | int | Type Speed test from the terminal to the acceleration gateway. 0:mobile 1:Wi-Fi 2:acc Speed test from the terminal to the T2 offloading point. 1001:default 1002:acc |
rtt | int | Latency (ms), default packet loss value: 60000. |
void onAccStateChanged(int state, int code)
Parameter | Type | Description |
state | int | 0: Disabled. 1: Enabled. |
code | int | 0: Enabled 1: Disabled 2: Abnormal Disable 3: Disable the onRevoke callback. |
void onDetectServerUpdate(int type, String ip, int port)
Parameter | Type | Description |
type | int | Type (0: mobile, 1: Wi-Fi, 2: acc) |
ip | String | Speed test IP address |
port | int | Speed test port |
Error Code | Description |
-1 | VPN fd null pointer exception |
-2 | MPQUIC exception |
-3 | Accelerated connection establishment exception |
-4 | Invalid package name or route address |
-5 | Acceleration service abnormal disconnection |
-6 | acc speed test packet loss rate abnormal |
-7 | acc acceleration maximum latency abnormal |
-8 | acc speed test latency abnormal compared to Wi-Fi |
-9 | acc speed test average latency exceeds maximum threshold |
-11 | Acceleration authentication failure |
-12 | Authentication connection timeout |
-13 | Authentication connection exception |
-17 | Acceleration parameters invalid |
-18 | Acceleration service startup failure |
-19 | Speed test service startup failure |
-21 | Account authentication failure |
-22 | Network adapter status does not meet acceleration requirements. |
-23 | Invalid speed test address |
-24 | Invalid custom network interface card plugin |
-25 | Invalid acceleration plugin |
-26 | No active network interface card on the current device. |
-28 | Terminal UDP ping failure |
-29 | Acceleration not supported for this device. |
-30 | Speed test parameters invalid. |
-31 | Acceleration has been canceled. |
-32 | HarmonyOS cellular activation restriction is abnormal. It is recommended to restart the machine to recover. |
100 | Multi-channel acceleration has been started. |
101 | Multi-channel acceleration internal error |
102 | Acceleration proxy enabling failure. |
103 | Invalid acceleration node IP address |
104 | Invalid acceleration mode |
105 | Acceleration token authentication failure. |
106 | The acceleration link notification is disabled. (Check whether multiple devices are reusing the dataKey.) |
107 | Channel handshake establishment timeout. (Check whether the dataKey is passed in public cloud mode.) |
108 | Acceleration reconnection timeout |
109 | SOCKS5 proxy failure |
110 | Maximum concurrent connections to the current gateway reached. |
Apakah halaman ini membantu?
Anda juga dapat Menghubungi Penjualan atau Mengirimkan Tiket untuk meminta bantuan.
masukan