AidConnect Android API
[TOC]
class AidConnect
Used for SDK initialization and log output control.
Public Member Functions
initialize()
javapublic static AidConnect initialize(Application mApplication, boolean logDebug, AidConnectCallback aidConnectCallback)
| Parameter Name | Type | Default | Description |
|---|
| mApplication | Application | - | Android Application object |
| logDebug | boolean | - | SDK log switch. true: prints all log levels; false: prints only error-level logs |
| aidConnectCallback | AidConnectCallback | - | Initialization callback |
| Type | Description |
|---|
| AidConnect | Returns the AidConnect singleton instance |
addChannelWithName();
javapublic static Set<String> addChannelWithName(String name, int size);
Creates a communication channel with the specified name and size, and returns the set of all channel names.
| Parameter Name | Type | Default | Description |
|---|
| name | String | - | User-defined channel name |
| size | int | - | Channel size in MB |
| Type | Description |
|---|
| Set<String> | Set of all channel names |
removeChannelWithName();
javapublic static Set<String> removeChannelWithName(String name);
Removes the communication channel with the specified name and returns the set of all channel names.
| Parameter Name | Type | Default | Description |
|---|
| name | String | - | Name of the channel to remove |
| Type | Description |
|---|
| Set<String> | Set of all channel names |
aidConnectWithName();
javapublic static synchronized AidConnect aidConnectWithName(String name);
Obtains the AidConnect instance for the specified channel, which is the core class for managing data interaction.
| Parameter Name | Type | Default | Description |
|---|
| name | String | - | Name of the channel to use |
| Type | Description |
|---|
| AidConnect | AidConnect instance |
setBytes();
javapublic boolean setBytes(byte[] bytes);
Writes data to the channel.
| Parameter Name | Type | Default | Description |
|---|
| bytes | byte[] | - | Byte array |
| Type | Description |
|---|
| boolean | Whether the write was successful |
getBytes();
javapublic byte[] getBytes(int len);
Reads data with the specified byte length.
| Parameter Name | Type | Default | Description |
|---|
| len | int | - | Number of bytes to read |
| Type | Description |
|---|
| byte[] | The byte array read from the channel |
getBytes();
javapublic byte[] getBytes();
Reads all data from the last write operation (length automatically matches the write length).
| Type | Description |
|---|
| byte[] | The byte array read from the channel |
getBytes();
javapublic byte[] getBytes(byte[] bytes, int len);
Reads data into a pre-allocated byte array with the specified length.
| Parameter Name | Type | Default | Description |
|---|
| bytes | byte[] | - | Pre-allocated byte array of size len |
| len | int | - | Number of bytes to read |
| Type | Description |
|---|
| byte[] | The byte array read from the channel |
release();
javapublic static synchronized int release();
Releases all resources.
None
| Type | Description |
|---|
| int | 0: success; non-zero: failure |
setStateCallback();
javapublic static void setStateCallback(RemoteSDKStatusCallBack remoteSDKStatusCallBack);
Sets the service connection status listener callback to receive server-side state change notifications.
| Parameter Name | Type | Default | Description |
|---|
| remoteSDKStatusCallBack | RemoteSDKStatusCallBack | - | Service status callback interface instance |