SDK referenceAidConnect Android API
Android-side connection interfaces.
class AidConnect
Used for SDK initialization and controlling log output
Public Member Functions
initialize()
public static boolean initialize(Application mApplication, boolean logDebug, AidConnectCallback aidConnectCallback)
| Parameter Name | Type | Default Value | Description |
|---|
| mApplication | Application | - | Android Application object |
| logDebug | boolean | - | SDK log switch: true prints all log levels; false prints only error logs |
| aidConnectCallback | AidConnectCallback | - | Initialization callback |
addChannelWithName()
public static Set addChannelWithName(String name, int size);
Creates a communication channel based on the user-defined channel name and size, and returns a set of all channel names.
| Parameter Name | Type | Default Value | Description |
|---|
| name | String | - | User-defined name of the channel to be transmitted |
| size | int | - | Channel size (unit: MB) |
| Type | Description |
|---|
| Set <String> | Set of all channel names |
removeChannelWithName()
public static Set removeChannelWithName(String name);
Removes the communication channel with the name passed by the user, and returns a set of all channel names.
| Parameter Name | Type | Default Value | Description |
|---|
| name | String | - | Name of the channel the user wants to remove |
| Type | Description |
|---|
| Set <String> | Set of all channel names |
aidConnectWithName()
public AidConnect aidConnectWithName(String name);
Creates a communication channel based on the user-defined channel name and obtains the core class AidConnect for managing interactions.
| Parameter Name | Type | Default Value | Description |
|---|
| name | String | - | Name of the channel the user wants to use for transmission |
| Type | Description |
|---|
| AidConnect | AidConnect class object |
setBytes()
public boolean setBytes(byte[] bytes);
Writes data to the channel.
| Parameter Name | Type | Default Value | Description |
|---|
| bytes | byte[] | - | Byte array to be written |
| Type | Description |
|---|
| boolean | true if written successfully; false otherwise |
getBytes()
public byte[] getBytes(int len);
Reads data according to the input byte length.
| Parameter Name | Type | Default Value | Description |
|---|
| len | int | - | Length of bytes to read |
| Type | Description |
|---|
| byte[] | Byte array of the read data |
getBytes()
public byte[] getBytes();
Reads data according to the length of the written byte data.
| Type | Description |
|---|
| byte[] | Byte array of the read data |
getBytes()
public byte[] getBytes(byte[] bytes, int len);
Reads data using a pre-created byte array and the input byte length.
| Parameter Name | Type | Default Value | Description |
|---|
| bytes | byte[] | - | Pre-defined byte array with size len |
| len | int | - | Length of the byte array to read |
| Type | Description |
|---|
| byte[] | Byte array of the read data |
release()
public int release();
Releases related resources.
| Type | Description |
|---|
| int | 0: Release successful; Non-0: Call failed |