Skip to content

AidConnect Android API

class AidConnect

Used for SDK initialization and controlling log output

Public Member Functions

initialize()

java
public static boolean initialize(Application mApplication, boolean logDebug, AidConnectCallback aidConnectCallback)
  • Parameters
Parameter NameTypeDefault ValueDescription
mApplicationApplication-Android Application object
logDebugboolean-SDK log switch: true prints all log levels; false prints only error logs
aidConnectCallbackAidConnectCallback-Initialization callback
  • Return None

addChannelWithName()

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

  • Parameters
Parameter NameTypeDefault ValueDescription
nameString-User-defined name of the channel to be transmitted
sizeint-Channel size (unit: MB)
  • Return
TypeDescription
Set <String>Set of all channel names

removeChannelWithName()

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

  • Parameters
Parameter NameTypeDefault ValueDescription
nameString-Name of the channel the user wants to remove
  • Return
TypeDescription
Set <String>Set of all channel names

aidConnectWithName()

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

  • Parameters
Parameter NameTypeDefault ValueDescription
nameString-Name of the channel the user wants to use for transmission
  • Return
TypeDescription
AidConnectAidConnect class object

setBytes()

java
public boolean setBytes(byte[] bytes);

Writes data to the channel.

  • Parameters
Parameter NameTypeDefault ValueDescription
bytesbyte[]-Byte array to be written
  • Return
TypeDescription
booleantrue if written successfully; false otherwise

getBytes()

java
public byte[] getBytes(int len);

Reads data according to the input byte length.

  • Parameters
Parameter NameTypeDefault ValueDescription
lenint-Length of bytes to read
  • Return
TypeDescription
byte[]Byte array of the read data

getBytes()

java
public byte[] getBytes();

Reads data according to the length of the written byte data.

  • Return
TypeDescription
byte[]Byte array of the read data

getBytes()

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

Reads data using a pre-created byte array and the input byte length.

  • Parameters
Parameter NameTypeDefault ValueDescription
bytesbyte[]-Pre-defined byte array with size len
lenint-Length of the byte array to read
  • Return
TypeDescription
byte[]Byte array of the read data

release()

java
public int release();

Releases related resources.

  • Parameters None

  • Return

TypeDescription
int0: Release successful; Non-0: Call failed