Rate This Document
Findability
Accuracy
Completeness
Readability

Processing Instruction Stream Engine Events

Application Scenario

Receive and process events reported by the instruction stream engine.

Prerequisites

The instruction stream engine has been started.

Development Process

Process different error codes in the onVmiEngineEvent callback function.

Encoding Instance

public void onVmiEngineEvent (int event, int reserved0, int reserved1, int reserved2, int reserved3, String additionInfo) {
    if (event == InstructionEngine.VMI_ENGINE_EVENT_SOCK_DISCONN) {
        // The network is disconnected.
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                // Stop logic threads.
                stopMonitorBlocked();
                if (upstreamReceiveDispatcher != null) {
                    upstreamReceiveDispatcher.stopBlocked();
                    upstreamReceiveDispatcher = null;
                }
                
                // Execute the reconnection process based on "Reconnecting to the Instruction Stream Cloud Phone."
                // Alternatively, exit the cloud phone.
            }
        });
    }
}