startConnection (int timeout)

Starts the connection for this application. If the connection was previously started, then this operation has no effect. You must set the appropriate connectionProperties before calling this operation.

If connection properties are improperly set, a ConnectionPropertyException is thrown. You can set the applicationCallback before calling this operation to receive asynchronous notification of connection status changes. If a callback handler is registered and network connectivity is available, the sequence of callbacks as a result of calling startConnection is:

onConnectionStatusChanged(ConnectionStatus.CONNECTING, 0, "")
 onConnectionStatusChanged(ConnectionStatus.CONNECTED, 0, "") 

If a callback handler is registered and network connectivity is unavailable, the sequence of callbacks as a result of calling startConnection is:

onConnectionStatusChanged(ConnectionStatus.CONNECTING, 0, null)
 onConnectionStatusChanged(ConnectionStatus.CONNECTION_ERROR, code, message) 

After a connection is successfully established, it can transition at any later time to CONNECTION_ERROR status or NOTIFICATION_WAIT status and subsequently back to CONNECTING and CONNECTED when connectivity resumes.

Syntax

public void startConnection(int timeout)

Parameters

Returns

None.

Examples