Checking for Manual ReachOut Messages of a Specified Type

The checkForReachOutOfType() function explicitly checks for manual ReachOut messages on the Server. checkForReachOutOfType() will check for ReachOut messages of a specified type, whereas checkForReachOut() will check for any manual ReachOut messages of any type.

Note:MultableInt and MutableObject are from org.apache.commons.lang.mutable.

checkForReachOutOfType() can be called between startSDK() and stopSDK(), and can be called zero or more times.

checkForReachOutOfType() is a synchronous function, returning when all functionality is completed.

checkForReachOutOfType()

RUIResult checkForReachOutOfType(MutableObject<String> message, MutableInt messageCount, MutableObject<RUIMessageType> messageTypeExpected)

Parameters

The checkForReachOutOfType() function has the following parameters.

checkForReachOutOfType() Parameters

Parameter

Description

message (MutableObject<String>)

A string of maximum length 256 that will be filled-in by the SDK with the message that is sent by the server.

messageCount (MutableInt)

Receives the message count (including returned message).

messageType (MutableObject<RUIMessageType>)

This value is filled by the developer and should contain the type of message that is being requested. This must be one of the RUIMessageType enum values.

Returns

The checkForReachOutOfType() function returns a RUIResult enum value with the following possible values

checkForReachOutOfType() Returns

Return

Description

OK

Function successful.

SDK_INTERNAL_ERROR_FATAL

Irrecoverable internal fatal error. No further API calls should be made.

SDK_ABORTED

A required New Registration has failed, and hence the SDK is aborted. stopSDK() is possible.

SDK_PERMANENTLY_DISABLED

The Server has instructed a permanent disable.

SDK_SUSPENDED

The Server has instructed a temporary back-off.

SDK_OPTED_OUT

Instance has been instructed by the application to opt-out.

CONFIG_NOT_CREATED

Configuration has not been successfully created.

SDK_ALREADY_STOPPED

SDK has already been successfully stopped.

SDK_NOT_STARTED

SDK has not been successfully started.

INVALID_MESSAGE_TYPE

The messageType is not an allowable value.

TIME_THRESHOLD_NOT_REACHED

The API call frequency threshold (set by the Server) has not been reached.

NETWORK_CONNECT_ERROR

Not able to reach the Server.

NETWORK_SERVER_ERROR

Error while communicating with the Server.

NETWORK_RESPONSE_INVALID

Message format error while communicating with the Server.

Code Example

The following is an example to get all text messages from the server and display them inside of a message box.

boolean registerDefaultReachOut = false;  // Java SDK has no default handler

RUISDK mySDK = new SDKImpl(registerDefaultReachOut);

// Other initialization.....

 

MutableObject<String> = new MutableObject<>("");

MultableInt msgCount = new MutableInt(0);

MutableObject<RUIMessageType> msgType = new MutableObject<>(RUIMessageType.TEXT);

 

while (mySDK.checkForReachOutOfType(message, msgCount, msgType) == RUIResult.OK &&

       msgCount > 0) {

    // code to display TEXT message

}