Building and Starting Libraries

After the Authentication is completed, the Access and Stream libraries can be utilized.

Calling the start() method of the libraries prepares the libraries to be fully ready to communicate with the platform.

Build and Starting the Access Library

Building Access

The Access library is built during authentication process. See this part for details.

Starting Access

When you start the Access platform library, it gets ready to handle subsequent platform communications.

To start the Access platform library, call start() method of Access class.
See the example code below.

Access.AccessRet startResult = AnyConnectApi.get().getAccess().start();
if (startResult == Access.AccessRet.OK){
    // The Access library is ready to handle subsequent platform communication API calls
} else {
    // The access library will retry internally to start but not yet ready for API calls
}
AccessRet startResult = access->start();
if (startResult == OK){
    // The Access library is ready to handle subsequent platform communication API calls
} else {
    // The access library will retry internally to start but not yet ready for API calls
}

Build and Starting the Stream Library

Building Stream

📘

Android

To start Stream library, call the build() method from Stream class first.

This is a thread blocking operation.

StreamRet buildResult = AnyConnectApi.get().getStream().build();
if(buildResult == StreamRet.OK){
    //If the `buildResult` is `OK` then library needed to start.
} else{
    //The build is failed
}

📘

iOS

Stream library build process in iOS is described in details in this section.

See the StreamRet section for details about buildResult.

Starting Stream

After successful build of Stream library, call start() method of Stream class to start the library.

StreamRet streamStartResult = AnyConnectApi.get().getStream().start();
if (streamStartResult == StreamRet.OK) {
    // The stream library is fully ready to be used
} else {
    // The stream library has failed to start
}
StreamRet streamStartResult = stream->start();
if (streamStartResult == OK) {
    // The stream library is fully ready to be used
} else {
    // The stream library has failed to start
}

See the StreamRet section for details about streamStartResult.