VMOS Cloud API
  • 简体中文
  • English
  • 简体中文
  • English
  • Product Introduction
  • Product Type
  • Product Billing
  • OpenAPI
    • User Guide
    • API Documentation
    • Error Code
    • Instance Property List
    • Android device modification attribute list
    • Callback Task Business Type Codes
    • Changelog
  • Android SDK
    • Example Construction
    • API Documentation
    • Callback Functions
    • Error Code
    • Changelog
  • Web H5 SDK
    • Example Build
    • API Documentation
    • H5 SDK Callback Functions
    • Error Code
    • Change log
  • Windows PC SDK
    • Example Setup
    • API Documentation
    • Callback Functions
    • Changelog
  • Edge-Cloud Communication Development
    • AIDL Integration Method
    • System Service API (AIDL)
  • Similar to XP, LSP Hook framework

    • Xposed-like / LSPosed Framework
    • Sensor Data Dynamic Simulation
  • Related agreements

API Interface Description

This document describes the interfaces provided by the Cloud Phone Android Client SDK.
You can also refer to the sample project for a more complete project implementation.

API Overview

Initialization

Method NameMethod Description
prepareInitialize ArmCloudEngine

Status

Variable NameVariable Description
engineStateGet current engine state

Lifecycle

Method NameMethod Description
startStart cloud phone
resumeResume streaming from cloud phone
pausePause streaming from cloud phone
stopStop cloud phone
onRequestPermissionsResultAutomatic permission handling

Function Control

Method NameMethod Description
screenShotScreenshot
videoStreamProfileIdSet cloud phone resolution
rotateRotate local screen orientation
muteAudioMute/Unmute audio
muteVideoMute/Unmute video
enableLocalKeyboardEnable local keyboard
enableLocationServiceEnable location service
enableGyroscopeSensorEnable gyroscope sensor
enableAccelerometerSensorEnable accelerometer sensor
enableVibratorEnable vibrator
enableCameraCamera permission
enableMicMicrophone permission
setLocationServiceModeSet location mode
getLocationServerGet location service
getClipBoardServiceManagerGet clipboard controller
switchCameraSwitch front/back camera
sendKeyEventSend simulated key event
autoRecycleTimeSet idle recycle service time (default 300s)
getAutoRecycleTimeGet idle recycle service time
streamTypeSet stream type: video/audio
updateVideoRenderModeUpdate video render mode
setVideoRotationModeSet video rotation mode
getStatusGet current playback status
getMessageChannelGet message channel controller
getUploadManagerGet file upload controller
getLocalInputManagerGet local keyboard and cloud app controller
getLocalInputManagerGet local keyboard and cloud app controller
startCaptureVideoStart local video capture
startCaptureAudioStart local audio capture
stopCaptureVideoStop local video capture
stopCaptureAudioStop local audio capture
startInjectVideoStreamStart video injection
stopInjectVideoStreamStop video injection
getVideoInjectStateGet video injection state

Event Listeners

Method NameMethod Description
setStreamProfileChangeListenerSet resolution change callback listener
setAutoRecycleTimeCallbackSet idle recycle time callback listener
setScreenShotCallBackSet local screenshot callback listener
setLocationEventListenerSet location event listener
setExecuteAdbCommandCallbackSet ADB command execution result callback
setInjectVideoListenerSet video injection callback listener

Initialization

Initialize ArmCloudEngine

Method:

ArmCloudEngine.prepare(mContext: Application, cloudCoreManagerStatusListener: ICloudCoreManagerStatusListener)

Parameters:
mContext:Application context object
cloudCoreManagerStatusListener:Initialization callback

Sample Code:

class MyApp : Application() {

    override fun onCreate() {
        super.onCreate()
        ArmCloudEngine.prepare(this, object : ICloudCoreManagerStatusListener {
            override fun onPrepared() {
                Log.i("ArmCloudEngine", "Initialization complete")
            }
        })
    }
}

Status

Get Engine State

Variable Name:

ArmCloudEngine.engineState

Variable Description: Type:int@EngineState
Description:Current engine state

EngineState:

Field NameDescription
STATE_AVAILABLEEngine available
STATE_UN_AVAILABLEEngine unavailable

Note: Before calling the start method, ensure the engine state is available.

Lifecycle

Start Cloud Phone

Method:

ArmCloudEngine.start(config: PhonePlayConfig, playerListener: IPlayerListener)

Parameters:
config:Initial configuration information
playerListener:Stream playback status callback listener

config field description:

Field NameField TypeRequiredField Description
contextFragmentActivityYesCurrent Activity context
tokenStringYesToken for joining room
userIdStringYesUser ID
clientTypeStringYesClient type
padCodeStringYesCloud push stream code
containerViewGroupYesVideo display container
enableMultiControlbooleanNoEnable multi-control
padCodesListNoMulti-control cloud phone code list
videoStreamProfileIdintNoResolution (default HD)
enableGyroscopeSensorbooleanNoEnable gyroscope sensor
enableAccelerometerSensorbooleanNoEnable accelerometer sensor
enableVibratorbooleanNoEnable vibrator
enableLocationServicebooleanNoEnable location service
enableLocalKeyboardbooleanNoEnable local keyboard
enableClipboardCloudPhoneSyncbooleanNoSync cloud phone clipboard to local
enableClipboardLocalPhoneSyncbooleanNoSync local clipboard to cloud phone
enableCamerabooleanNoEnable camera permission
enableMicbooleanNoEnable microphone permission
autoRecycleTimeintNoIdle auto-stop service time (default 300s)
streamTypeString@StreamTypeNoStream type (default audio+video)
remoteLocationMockLocationInfoNoLocation information
rotationString@ScreenRotationTypeNoLocal screen rotation (default portrait)
videoRenderModeint@VideoRenderModeNoVideo render mode (default fit)
videoRotationModeint@VideoRotationModeNoVideo rotation mode (default external handling)
streamListenerIStreamListenerNoStream listener

Field Type Information:

StreamType:

Field NameDescription
TYPE_VIDEOVideo
TYPE_AUDIOAudio
TYPE_BOTHAudio+Video

ScreenRotationType:

Field NameDescription
TYPE_LANDSCAPELandscape
TYPE_PORTRAITPortrait

VideoRenderMode:

Field NameDescription
VIDEO_RENDER_MODE_COVERShort side fills container
VIDEO_RENDER_MODE_FITScale proportionally and center in container
VIDEO_RENDER_MODE_FILLStretch to fill entire container

VideoRotationMode:

Field NameDescription
EXTERNALExternal rotation (default); user must listen to IStreamListener#onRotation(int) to adjust orientation externally
INTERNALInternal rotation; SDK handles rotation internally, no external handling needed

Stream Media ConnectionState:

Field NameValueDescription
CONNECTION_STATE_DISCONNECTED1Disconnected for over 12s; SDK will attempt auto-reconnect.
CONNECTION_STATE_CONNECTING2First connection request in progress.
CONNECTION_STATE_CONNECTED3First connection successful.
CONNECTION_STATE_RECONNECTING4Covers: first connect timeout >10s or disconnect >10s after success. Auto-reconnecting.
CONNECTION_STATE_RECONNECTED5Reconnected successfully after disconnect.
CONNECTION_STATE_LOST6Disconnected >10s without successful reconnect. SDK continues attempting.
CONNECTION_STATE_FAILED7Connection failed due to server issue. No auto-reconnect; rejoin or contact support.

P2P ConnectionState:

Field NameValueDescription
STATE_NEW10Initialized
STATE_CHECKING11Connecting
STATE_CONNECTED3Connected
STATE_FAILED7Failed
STATE_COMPLETED14Completed
STATE_DISCONNECTED15Disconnected
STATE_CLOSED16Closed

Sample Code:

val builder: PhonePlayConfig.Builder = PhonePlayConfig.Builder()
builder.context(this)
    .userId(dto.userId) // Required: Custom client user ID
    .padCode(dto.padCode) // Required: Cloud phone instance ID
    .token(dto.token) // Required: Temporary auth token
    .clientType(dto.clientType) // Required: Client type
    .container(container) // Required: Container for rendering (must be FrameLayout or subclass)
    .enableMultiControl(isMultiControl) // Optional: Enable multi-control
    .setPadCodes(mChosePadCodes) // Optional: Multi-control device codes
    .rotation(rotation) // Optional: Screen orientation (default portrait)
    .videoStreamProfileId(
        videoStreamProfileId.definition,
        videoStreamProfileId.frameRate,
        videoStreamProfileId.bitrate
    ) // Optional: Resolution profile (default HD)
    .enableGyroscopeSensor(enableGyroscopeSensor) // Optional: Gyroscope
    .enableAccelerometerSensor(enableAccelerometerSensor) // Optional: Accelerometer
    .enableVibrator(enableVibrator) // Optional: Vibrator
    .enableLocationService(enableLocationService) // Optional: Location service
    .enableLocalKeyboard(enableLocalKeyboard) // Optional: Local keyboard
    .enableClipboardCloudPhoneSync(enableCloudSync) // Optional: Cloud → local clipboard sync (default true)
    .enableClipboardLocalPhoneSync(enableLocalSync) // Optional: Local → cloud clipboard sync (default true)
    .enableCamera(enableCamera) // Optional: Camera permission (default true)
    .enableMic(enableMic) // Optional: Mic permission (default false)
    .streamType(streamType) // Optional: Stream type (default audio+video)
    .videoRenderMode(renderMode) // Optional: Video render mode (default fit)
    .videoRotationMode(videoRotationMode) // Optional: Video rotation mode (default external)
    .autoRecycleTime(autoRecyclerTime.toInt())
    // Stream listener
    .streamListener(object : IStreamListener {
        override fun onFirstAudioFrame(uid: String) {
            runOnUiThread {
                Toast.makeText(
                    this@MainActivity,
                    "First audio frame received",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }
        
        override fun onRemoteAudio(byteBuffer: ByteBuffer) {
        }

        override fun onFirstRemoteVideoFrame(uid: String, width: Int, height: Int) {
            runOnUiThread {
                Toast.makeText(
                    this@MainActivity,
                    "First video frame received",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }

        override fun onVideoSizeChanged(uid: String, width: Int, height: Int) {
        }

        override fun onStreamPaused() {
            runOnUiThread {
                Toast.makeText(
                    this@MainActivity,
                    "Stream paused callback",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }

        override fun onStreamConnectionStateChanged(state: Int, reason: Int) {
            runOnUiThread {
                Toast.makeText(
                    this@MainActivity,
                    "Stream connection state changed: $state",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }

        override fun onScreenRotation(rotationType: Int) {
            runOnUiThread {
                requestedOrientation =
                    if (rotationType == ScreenRotationType.TYPE_PORTRAIT) ActivityInfo.SCREEN_ORIENTATION_PORTRAIT else ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
                Toast.makeText(
                    this@MainActivity,
                    "Screen rotation: ${if (rotationType == ScreenRotationType.TYPE_PORTRAIT) "Portrait" else "Landscape"}",
                    Toast.LENGTH_SHORT
                ).show()
            }
        }
    })

ArmCloudEngine.start(builder.build(), object : IPlayerListener {
    override fun onPlaySuccess(videoStreamProfileId: Int) {
        Log.e("am", "onPlaySuccess ===> videoStreamProfileId: $videoStreamProfileId")
        runOnUiThread {
            tvRoomId?.text = "Current room: ${builder.padCode}"
            Toast.makeText(this@MainActivity, "Stream success", Toast.LENGTH_SHORT).show()
        }
        initListener()
    }

    override fun onError(code: Int, msg: String) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "onError code:$code msg: $msg ",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onWarning(code: Int, msg: String) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "onWarning code:$code  $msg ",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onNetworkChanged(var1: Int) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "onNetworkChanged code:$var1",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onServiceInit(extras: Map<String, Any>?) {
        runOnUiThread {
            ArmCloudEngine.getClipBoardServiceManager()?.setBoardSyncClipListener(object :
                IClipBoardListener {
                override fun onClipBoardMessageReceived(data: String) {
                    Toast.makeText(
                        this@MainActivity,
                        "Clipboard message received: $data",
                        Toast.LENGTH_SHORT
                    ).show()
                }
            })
            Toast.makeText(this@MainActivity, "onServiceInit", Toast.LENGTH_SHORT).show()
        }
    }

    override fun networkQualityRtt(rtt: Int) {
        runOnUiThread {
            tvQuality?.text = "NetworkQuality: $rtt ms"
            Toast.makeText(this@MainActivity, "networkQualityRtt $rtt", Toast.LENGTH_SHORT).show()
        }
    }

    override fun onMultiCloudPhoneJoin(padCode: String) {
        runOnUiThread {
            ToastUtils.showShort("Multi-control user joined")
        }
    }

    override fun onMultiCloudPhoneLeave(padCode: String) {
        runOnUiThread {
            ToastUtils.showShort("Multi-control user left")
        }
    }
})

Resume Streaming from Cloud Phone

Method:

ArmCloudEngine.resume()

Sample Code:

override fun onResume() {
    super.onResume()
    ArmCloudEngine.resume()
}

Pause Streaming from Cloud Phone

Method:

ArmCloudEngine.pause()

Sample Code:

override fun onPause() {
    super.onPause()
    ArmCloudEngine.pause()
}

Stop Cloud Phone

Method:

ArmCloudEngine.stop()

Sample Code:

override fun onDestroy() {
    super.onDestroy()
    ArmCloudEngine.stop()
}

Permission Handling

Method:

ArmCloudEngine.onRequestPermissionsResult(requestCode, permissions, grantResults)

Sample Code:

override fun onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<String?>,
    grantResults: IntArray
) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults)
    ArmCloudEngine.onRequestPermissionsResult(requestCode, permissions, grantResults)
}

Function Control

Screenshot

Method:

ArmCloudEngine.screenShot(@ScreenShotType screenShotType: Int)

Parameters: screenShotType: Screenshot type

Field NameDescription
TYPE_LOCALSave to local
TYPE_CLOUDSave to cloud

Set Cloud Phone Resolution

Method 1:

ArmCloudEngine.videoStreamProfileId(videoDefinitionEnum: VideoDefinitionEnum)

Parameters: VideoDefinitionEnum:

Field NameDescription
DEFINITION_BBlu-ray
DEFINITION_SUltra HD
DEFINITION_HHD
DEFINITION_LSD

Method 2:

ArmCloudEngine.videoStreamProfileId(definition: String, frameRateId: String, bitrateId: String)

Parameters:
definition:Resolution
frameRateId:Frame rate
bitrateId:Bitrate

FieldDescription
Resolution07:144×256 08:216×384 09:288×512 10:360×640 11:480×848 12:540×960 13:600×1024 14:480×1280 15:720×1280 16:720×1920 17:1080×1920 18:1440×1920 19:1600×2560 20:2880×1080
Frame Rate1:20fps 2:25fps 3:30fps 4:60fps 5:1fps 6:5fps 7:10fps 8:15fps 9:2fps
Bitrate01:1Mbps 02:1.5Mbps 03:2Mbps 04:2.5Mbps 05:3Mbps 06:3.5Mbps 07:4Mbps 08:5Mbps 09:6Mbps 10:8Mbps 11:10Mbps 12:12Mbps 13:200kbps 14:400kbps 15:600kbps

Rotate Local Screen Orientation

Method:

ArmCloudEngine.rotate(ScreenRotationType.TYPE_LANDSCAPE)

Parameters: Same as PhonePlayConfig local rotation setting

Mute Audio

Method:

ArmCloudEngine.muteAudio(isMetuAudio)

Parameters: isMetuAudio: true to mute, false to unmute

Mute Video

Method:

ArmCloudEngine.muteVideo(isMetuVideo)

Parameters: isMetuVideo: true to mute, false to unmute

Enable Local Keyboard

Method:

ArmCloudEngine.enableLocalKeyboard(isEnable)

Parameters: isEnable: true to enable, false to disable

Enable Location Service

Method:

ArmCloudEngine.enableLocationService(isEnable)

Parameters: isEnable: true to enable, false to disable

Enable Gyroscope Sensor

Method:

ArmCloudEngine.enableGyroscopeSensor(isEnable)

Parameters: isEnable: true to enable, false to disable

Enable Accelerometer Sensor

Method:

ArmCloudEngine.enableAccelerometerSensor(isEnable)

Parameters: isEnable: true to enable, false to disable

Enable Vibrator

Method:

ArmCloudEngine.enableVibrator(isEnable)

Parameters: isEnable: true to enable, false to disable

Camera Permission

Method:

ArmCloudEngine.enableCamera(isEnable)

Parameters: isEnable: true to enable, false to disable

Microphone Permission

Method:

ArmCloudEngine.enableMic(isEnable)

Parameters: isEnable: true to enable, false to disable

Set Location Mode

Method:

ArmCloudEngine.setLocationServiceMode(mode@LocationMode)

Parameters: mode:Location mode

Field NameDescription
MODE_AUTOAuto mode: SDK automatically collects location
MODE_MANUALManual mode: Set listener via setLocationEventListener and manually pass location using remoteLocationMock

Get Location Service

Method:

ArmCloudEngine.getLocationServer()

Return Value: Type:ILocationService Description:Location service

ILocationService

MethodParametersDescription
enableLocationService(isEnable: Boolean)isEnable: Whether to enableEnable/disable location
remoteLocationMock( @FloatRange(from = -90.0, to = 90.0) latitude: Double, @FloatRange(from = -180.0, to = 180.0) longitude: Double)latitude: Latitude longitude:LongitudeSet location
remoteLocationMock( @FloatRange(from = -90.0, to = 90.0) latitude: Double, @FloatRange(from = -180.0, to = 180.0) longitude: Double, altitude: Double = 0.0, bearing: Float = 0.0f, accuracy: Float = 0.0f, speed: Float = 0.0f, time: Long = System.currentTimeMillis(), elapsedRealtimeNanos: Long = SystemClock.uptimeMillis(), satellites: Int = 0)latitude: Latitude longitude:Longitude altitude: Altitude bearing: Bearing accuracy: Accuracy radius (meters) speed: Speed (m/s) time: Unix timestamp elapsedRealtimeNanos: Elapsed realtime nanos satellites: Satellite countSet location

Get Clipboard Controller

Method:

ArmCloudEngine.getClipBoardServiceManager()

Return Value: Type:IClipBoardServiceManager Description:Clipboard service

IClipBoardServiceManager

MethodParametersDescription
setBoardSyncClipListener(iClipBoardListener)iClipBoardListener@IClipBoardListener: Cloud clipboard listenerSet cloud clipboard listener
sendClipBoardMessage(data: String)data:Text dataManually send clipboard data
enableClipboardLocalPhoneSync(isEnable: Boolean)isEnable:Whether to enableEnable local → cloud clipboard sync
enableClipboardCloudPhoneSync(isEnable: Boolean)isEnable:Whether to enableEnable cloud → local clipboard sync

Switch Front/Back Camera

Method:

ArmCloudEngine.switchCamera(isBack)

Parameters: isBack: true for back camera, false for front

Send Simulated Key Event

Method:

ArmCloudEngine.sendKeyEvent(systemKeyStrokeEnum: SystemKeyStrokeEnum)

Parameters: systemKeyStrokeEnum: Key enum

Enum NameDescription
BACKBack key
HOMEHome
JOBRecent tasks
MENUMenu
VOLUME_ADDVolume up
VOLUME_LESSVolume down

Set Idle Recycle Time

Method:

ArmCloudEngine.autoRecycleTime(recycleTime)

Parameters: recycleTime: Idle recycle time in seconds

Get Idle Recycle Time

Method:

ArmCloudEngine.getAutoRecycleTime()

Return Value: Type:int Description:Idle recycle time in seconds

Set Stream Type

Method:

ArmCloudEngine.streamType(streamType)

Parameters: Same as PhonePlayConfig stream type

Update Video Render Mode

Method:

ArmCloudEngine.updateVideoRenderMode(renderMode)

Parameters: Same as PhonePlayConfig video render mode

Set Video Rotation Mode

Method:

ArmCloudEngine.setVideoRotationMode(rotationMode)

Parameters: Same as PhonePlayConfig video rotation mode

Get Current Playback Status

Method:

ArmCloudEngine.getStatus()

Return Value: Type:int@CloudPhoneState Description:Current playback status

CloudPhoneState:

Field NameDescription
STATE_UN_INIT0x0001 Uninitialized
STATE_INIT_SUCCESS0x0002 Initialized successfully
STATE_START0x0003 Streaming started
STATE_RUN0x0004 Streaming successful
STATE_STOP0x0005 Streaming stopped

Get Message Channel Controller

Method:

ArmCloudEngine.getMessageChannel()

Return Value: Type:IMessageChannel Description:Message channel controller

IMessageChannel Methods:

MethodParametersDescription
setMessageListener(listener: IMessageReceiver?)listener@IMessageReceiver: Message listenerSet listener for messages from cloud to local
sendMessage(type: Int, data: String, binderService: String, packageName: String)type: Message type data: Message body binderService: Remote service name packageName: Package nameSend message to specified service in cloud

Get File Upload Controller

Method:

ArmCloudEngine.getUploadManager(application)

Parameters: application:Global context

Return Value: Type:IUploadFileManager Description:File upload controller

IUploadFileManager Methods:

MethodParametersDescription
uploadFile(lifecycleOwner: LifecycleOwner, padCode: String, token: String, path: String, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack )lifecycleOwner: Lifecycle owner padCode:Cloud phone ID token: Temporary token path: File path uploadFilePath@UploadFilePath: Destination path in cloud uploadFileCallBack@IUploadFileCallBack:Upload listenerLifecycle-aware file upload
uploadFile(lifecycleOwner: LifecycleOwner, padCode: String, token: String, file: File, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack )lifecycleOwner: Lifecycle owner padCode:Cloud phone ID token: Temporary token file: File to upload uploadFilePath@UploadFilePath: Destination path uploadFileCallBack@IUploadFileCallBack:Upload listenerLifecycle-aware file upload
uploadFile(padCode: String, token: String, path: String, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack )padCode:Cloud phone ID token: Temporary token path: File path uploadFilePath@UploadFilePath: Destination path uploadFileCallBack@IUploadFileCallBack:Upload listenerFile upload
uploadFile(padCode: String, token: String, file: File, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack )padCode:Cloud phone ID token: Temporary token file: File to upload uploadFilePath@UploadFilePath: Destination path uploadFileCallBack@IUploadFileCallBack:Upload listenerFile upload
cancelUpload(path: String)path: File pathCancel upload

UploadFilePath:

Field NameDescription
PATH_DCIMDCIM directory
PATH_DOCUMENTSDocuments directory
PATH_DOWNLOADDownload directory
PATH_MOVIESMovies directory
PATH_MUSICMusic directory
PATH_PICTURESPictures directory

Get Local Keyboard and Cloud App Controller

Method:

ArmCloudEngine.getLocalInputManager()

Return Value: Type:ILocalInputManager Description:Local keyboard and cloud app controller

ILocalInputManager Methods:

MethodParametersDescription
sendInputText(text: String)text: Text contentSend text to cloud input field

Start Local Video Capture

Method:

ArmCloudEngine.startCaptureVideo()

Start Local Audio Capture

Method:

ArmCloudEngine.startCaptureAudio()

Stop Local Video Capture

Method:

ArmCloudEngine.stopCaptureVideo()

Stop Local Audio Capture

Method:

ArmCloudEngine.stopCaptureAudio()

Start Video Injection

Method:

ArmCloudEngine.startInjectVideoStream(path: String, isLoop: Boolean, fileName: String?)

Parameters:

ParameterTypeRequiredDescription
pathStringYesVideo path: URL or cloud file path
isLoopBooleanYesLoop playback
fileNameStringNoFile name (required when path is URL)

Video Requirements:

ItemRequirement
Supported FormatsH.264, H.265 encoding
ResolutionWidth and height must be multiples of 2

Stop Video Injection

Method:

ArmCloudEngine.stopInjectVideoStream()

Get Video Injection State

Method:

ArmCloudEngine.getVideoInjectState()

Description: Video injection state callbacks are received in @IInjectVideoListener

Event Listeners

Set Resolution Change Callback Listener

Method:

setStreamProfileChangeListener(streamProfileChangeCallBack: StreamProfileChangeCallBack)

Parameters: streamProfileChangeCallBack:Resolution change callback

Sample Code:

ArmCloudEngine.setStreamProfileChangeListener(object : StreamProfileChangeCallBack {
    override fun onVideoStreamProfileChange(
        isSuccess: Boolean,
        from: String,
        current: String
    ) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Resolution change success from:$from to:$current",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
})

Set Idle Recycle Time Callback Listener

Method:

setAutoRecycleTimeCallback(autoRecycleTimeCallback: SetAutoRecycleTimeCallback)

Parameters: autoRecycleTimeCallback:Idle recycle time callback

Sample Code:

ArmCloudEngine.setAutoRecycleTimeCallback(object : SetAutoRecycleTimeCallback {
    override fun onResult(autoRecycleTime: Int) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Idle recycle callback timeout:$autoRecycleTime",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
})

Set Local Screenshot Callback Listener

Method:

setScreenShotCallBack(screenShotCallBack: ScreenShotCallBack)

Parameters: ScreenShotCallBack:Local screenshot listener

Sample Code:

ArmCloudEngine.setScreenShotCallBack(object : ScreenShotCallBack {
    override fun onScreenShot(bitmap: Bitmap) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Local screenshot received:${bitmap.byteCount}",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
})

Set Location Event Listener

Method:

setLocationEventListener(locationEventListener: LocationEventListener)

Parameters: locationEventListener:Location listener

Sample Code:

ArmCloudEngine.setLocationEventListener(object : LocationEventListener {

    override fun onReceivedRemoteLocationRequest(requestOptions: RequestOptions) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Cloud phone requests location permission",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onRemoteLocationRequestEnded() {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Cloud phone stops location request",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onSentLocalLocation(locationInfo: LocationInfo) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Local location sent",
                Toast.LENGTH_SHORT
            ).show()
        }
    }

    override fun onRemoteLocationUpdated(locationInfo: LocationInfo) {
        runOnUiThread {
            Toast.makeText(
                this@MainActivity,
                "Cloud location updated",
                Toast.LENGTH_SHORT
            ).show()
        }
    }
})

Set ADB Command Execution Callback Listener

Method:

setExecuteAdbCommandCallback(iExecuteAdbCommandCallback: IExecuteAdbCommandCallback)

Parameters: iExecuteAdbCommandCallback:ADB command result callback

Sample Code:

ArmCloudEngine.setExecuteAdbCommandCallback(object : IExecuteAdbCommandCallback {
    override fun onExecuteAdbCommandResult(isSuccess: Boolean, content: String) {
        ToastUtils.showShort("ADB command executed isSuccess: $isSuccess resultMsg: $content")
        Log.e(
            TAG,
            "onExecuteAdbCommandResult isSuccess ===> $isSuccess  content ===> $content"
        )
    }
})

Set Video Injection Callback Listener

Method:

setInjectVideoListener(iInjectVideoListener: IInjectVideoListener)

Parameters: iInjectVideoListener:Video injection callback

Sample Code:

ArmCloudEngine.setInjectVideoListener(object : IInjectVideoListener {
    override fun onInjectCallBack(code: String, content: String) {
        Log.e(
            TAG,
            "onInjectCallBack code: $code  content: $content"
        )
        ToastUtils.showShort(content)
    }

    override fun onVideoInjectInfo(@VideoInjectState state: Int, videoPath: String?) {
        Log.e(
            TAG,
            "videoInjectState state: $state"
        )
        ToastUtils.showShort("videoInjectState state: $state  videoPath: $videoPath")
    }
})
Prev
Example Construction
Next
Callback Functions