Skip to content

AidConnect Android API

[TOC]

class AidConnect

Used for SDK initialization and log output control.

Public Member Functions

initialize()

java
public static AidConnect initialize(Application mApplication, boolean logDebug, AidConnectCallback aidConnectCallback)
  • Parameters
Parameter NameTypeDefaultDescription
mApplicationApplication-Android Application object
logDebugboolean-SDK log switch. true: prints all log levels; false: prints only error-level logs
aidConnectCallbackAidConnectCallback-Initialization callback
  • Return
TypeDescription
AidConnectReturns the AidConnect singleton instance

addChannelWithName();

java
public 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.

  • Parameters
Parameter NameTypeDefaultDescription
nameString-User-defined channel name
sizeint-Channel size in MB
  • Return
TypeDescription
Set<String>Set of all channel names

removeChannelWithName();

java
public static Set<String> removeChannelWithName(String name);

Removes the communication channel with the specified name and returns the set of all channel names.

  • Parameters
Parameter NameTypeDefaultDescription
nameString-Name of the channel to remove
  • Return
TypeDescription
Set<String>Set of all channel names

aidConnectWithName();

java
public static synchronized AidConnect aidConnectWithName(String name);

Obtains the AidConnect instance for the specified channel, which is the core class for managing data interaction.

  • Parameters
Parameter NameTypeDefaultDescription
nameString-Name of the channel to use
  • Return
TypeDescription
AidConnectAidConnect instance

setBytes();

java
public boolean setBytes(byte[] bytes);

Writes data to the channel.

  • Parameters
Parameter NameTypeDefaultDescription
bytesbyte[]-Byte array
  • Return
TypeDescription
booleanWhether the write was successful

getBytes();

java
public byte[] getBytes(int len);

Reads data with the specified byte length.

  • Parameters
Parameter NameTypeDefaultDescription
lenint-Number of bytes to read
  • Return
TypeDescription
byte[]The byte array read from the channel

getBytes();

java
public byte[] getBytes();

Reads all data from the last write operation (length automatically matches the write length).

  • Return
TypeDescription
byte[]The byte array read from the channel

getBytes();

java
public byte[] getBytes(byte[] bytes, int len);

Reads data into a pre-allocated byte array with the specified length.

  • Parameters
Parameter NameTypeDefaultDescription
bytesbyte[]-Pre-allocated byte array of size len
lenint-Number of bytes to read
  • Return
TypeDescription
byte[]The byte array read from the channel

release();

java
public static synchronized int release();

Releases all resources.

  • Parameters

None

  • Return
TypeDescription
int0: success; non-zero: failure

setStateCallback();

java
public static void setStateCallback(RemoteSDKStatusCallBack remoteSDKStatusCallBack);

Sets the service connection status listener callback to receive server-side state change notifications.

  • Parameters
Parameter NameTypeDefaultDescription
remoteSDKStatusCallBackRemoteSDKStatusCallBack-Service status callback interface instance
  • Note

    The SDK has already set a default callback instance during initialization. Call this method only when custom listening is needed.

Last updated: