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 Name | Method Description |
|---|---|
| prepare | Initialize ArmCloudEngine |
Status
| Variable Name | Variable Description |
|---|---|
| engineState | Get current engine state |
Lifecycle
| Method Name | Method Description |
|---|---|
| start | Start cloud phone |
| resume | Resume streaming from cloud phone |
| pause | Pause streaming from cloud phone |
| stop | Stop cloud phone |
| onRequestPermissionsResult | Automatic permission handling |
Function Control
| Method Name | Method Description |
|---|---|
| screenShot | Screenshot |
| videoStreamProfileId | Set cloud phone resolution |
| rotate | Rotate local screen orientation |
| muteAudio | Mute/Unmute audio |
| muteVideo | Mute/Unmute video |
| enableLocalKeyboard | Enable local keyboard |
| enableLocationService | Enable location service |
| enableGyroscopeSensor | Enable gyroscope sensor |
| enableAccelerometerSensor | Enable accelerometer sensor |
| enableVibrator | Enable vibrator |
| enableCamera | Camera permission |
| enableMic | Microphone permission |
| setLocationServiceMode | Set location mode |
| getLocationServer | Get location service |
| getClipBoardServiceManager | Get clipboard controller |
| switchCamera | Switch front/back camera |
| sendKeyEvent | Send simulated key event |
| autoRecycleTime | Set idle recycle service time (default 300s) |
| getAutoRecycleTime | Get idle recycle service time |
| streamType | Set stream type: video/audio |
| updateVideoRenderMode | Update video render mode |
| setVideoRotationMode | Set video rotation mode |
| getStatus | Get current playback status |
| getMessageChannel | Get message channel controller |
| getUploadManager | Get file upload controller |
| getLocalInputManager | Get local keyboard and cloud app controller |
| getLocalInputManager | Get local keyboard and cloud app controller |
| startCaptureVideo | Start local video capture |
| startCaptureAudio | Start local audio capture |
| stopCaptureVideo | Stop local video capture |
| stopCaptureAudio | Stop local audio capture |
| startInjectVideoStream | Start video injection |
| stopInjectVideoStream | Stop video injection |
| getVideoInjectState | Get video injection state |
Event Listeners
| Method Name | Method Description |
|---|---|
| setStreamProfileChangeListener | Set resolution change callback listener |
| setAutoRecycleTimeCallback | Set idle recycle time callback listener |
| setScreenShotCallBack | Set local screenshot callback listener |
| setLocationEventListener | Set location event listener |
| setExecuteAdbCommandCallback | Set ADB command execution result callback |
| setInjectVideoListener | Set 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 Name | Description |
|---|---|
| STATE_AVAILABLE | Engine available |
| STATE_UN_AVAILABLE | Engine 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 Name | Field Type | Required | Field Description |
|---|---|---|---|
| context | FragmentActivity | Yes | Current Activity context |
| token | String | Yes | Token for joining room |
| userId | String | Yes | User ID |
| clientType | String | Yes | Client type |
| padCode | String | Yes | Cloud push stream code |
| container | ViewGroup | Yes | Video display container |
| enableMultiControl | boolean | No | Enable multi-control |
| padCodes | List | No | Multi-control cloud phone code list |
| videoStreamProfileId | int | No | Resolution (default HD) |
| enableGyroscopeSensor | boolean | No | Enable gyroscope sensor |
| enableAccelerometerSensor | boolean | No | Enable accelerometer sensor |
| enableVibrator | boolean | No | Enable vibrator |
| enableLocationService | boolean | No | Enable location service |
| enableLocalKeyboard | boolean | No | Enable local keyboard |
| enableClipboardCloudPhoneSync | boolean | No | Sync cloud phone clipboard to local |
| enableClipboardLocalPhoneSync | boolean | No | Sync local clipboard to cloud phone |
| enableCamera | boolean | No | Enable camera permission |
| enableMic | boolean | No | Enable microphone permission |
| autoRecycleTime | int | No | Idle auto-stop service time (default 300s) |
| streamType | String@StreamType | No | Stream type (default audio+video) |
| remoteLocationMock | LocationInfo | No | Location information |
| rotation | String@ScreenRotationType | No | Local screen rotation (default portrait) |
| videoRenderMode | int@VideoRenderMode | No | Video render mode (default fit) |
| videoRotationMode | int@VideoRotationMode | No | Video rotation mode (default external handling) |
| streamListener | IStreamListener | No | Stream listener |
Field Type Information:
StreamType:
| Field Name | Description |
|---|---|
| TYPE_VIDEO | Video |
| TYPE_AUDIO | Audio |
| TYPE_BOTH | Audio+Video |
ScreenRotationType:
| Field Name | Description |
|---|---|
| TYPE_LANDSCAPE | Landscape |
| TYPE_PORTRAIT | Portrait |
VideoRenderMode:
| Field Name | Description |
|---|---|
| VIDEO_RENDER_MODE_COVER | Short side fills container |
| VIDEO_RENDER_MODE_FIT | Scale proportionally and center in container |
| VIDEO_RENDER_MODE_FILL | Stretch to fill entire container |
VideoRotationMode:
| Field Name | Description |
|---|---|
| EXTERNAL | External rotation (default); user must listen to IStreamListener#onRotation(int) to adjust orientation externally |
| INTERNAL | Internal rotation; SDK handles rotation internally, no external handling needed |
Stream Media ConnectionState:
| Field Name | Value | Description |
|---|---|---|
| CONNECTION_STATE_DISCONNECTED | 1 | Disconnected for over 12s; SDK will attempt auto-reconnect. |
| CONNECTION_STATE_CONNECTING | 2 | First connection request in progress. |
| CONNECTION_STATE_CONNECTED | 3 | First connection successful. |
| CONNECTION_STATE_RECONNECTING | 4 | Covers: first connect timeout >10s or disconnect >10s after success. Auto-reconnecting. |
| CONNECTION_STATE_RECONNECTED | 5 | Reconnected successfully after disconnect. |
| CONNECTION_STATE_LOST | 6 | Disconnected >10s without successful reconnect. SDK continues attempting. |
| CONNECTION_STATE_FAILED | 7 | Connection failed due to server issue. No auto-reconnect; rejoin or contact support. |
P2P ConnectionState:
| Field Name | Value | Description |
|---|---|---|
| STATE_NEW | 10 | Initialized |
| STATE_CHECKING | 11 | Connecting |
| STATE_CONNECTED | 3 | Connected |
| STATE_FAILED | 7 | Failed |
| STATE_COMPLETED | 14 | Completed |
| STATE_DISCONNECTED | 15 | Disconnected |
| STATE_CLOSED | 16 | Closed |
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 Name | Description |
|---|---|
| TYPE_LOCAL | Save to local |
| TYPE_CLOUD | Save to cloud |
Set Cloud Phone Resolution
Method 1:
ArmCloudEngine.videoStreamProfileId(videoDefinitionEnum: VideoDefinitionEnum)
Parameters: VideoDefinitionEnum:
| Field Name | Description |
|---|---|
| DEFINITION_B | Blu-ray |
| DEFINITION_S | Ultra HD |
| DEFINITION_H | HD |
| DEFINITION_L | SD |
Method 2:
ArmCloudEngine.videoStreamProfileId(definition: String, frameRateId: String, bitrateId: String)
Parameters:
definition:Resolution
frameRateId:Frame rate
bitrateId:Bitrate
| Field | Description |
|---|---|
| Resolution | 07: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 Rate | 1:20fps 2:25fps 3:30fps 4:60fps 5:1fps 6:5fps 7:10fps 8:15fps 9:2fps |
| Bitrate | 01: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 Name | Description |
|---|---|
| MODE_AUTO | Auto mode: SDK automatically collects location |
| MODE_MANUAL | Manual 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
| Method | Parameters | Description |
|---|---|---|
| enableLocationService(isEnable: Boolean) | isEnable: Whether to enable | Enable/disable location |
| remoteLocationMock( @FloatRange(from = -90.0, to = 90.0) latitude: Double, @FloatRange(from = -180.0, to = 180.0) longitude: Double) | latitude: Latitude longitude:Longitude | Set 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 count | Set location |
Get Clipboard Controller
Method:
ArmCloudEngine.getClipBoardServiceManager()
Return Value: Type:IClipBoardServiceManager Description:Clipboard service
IClipBoardServiceManager
| Method | Parameters | Description |
|---|---|---|
| setBoardSyncClipListener(iClipBoardListener) | iClipBoardListener@IClipBoardListener: Cloud clipboard listener | Set cloud clipboard listener |
| sendClipBoardMessage(data: String) | data:Text data | Manually send clipboard data |
| enableClipboardLocalPhoneSync(isEnable: Boolean) | isEnable:Whether to enable | Enable local → cloud clipboard sync |
| enableClipboardCloudPhoneSync(isEnable: Boolean) | isEnable:Whether to enable | Enable 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 Name | Description |
|---|---|
| BACK | Back key |
| HOME | Home |
| JOB | Recent tasks |
| MENU | Menu |
| VOLUME_ADD | Volume up |
| VOLUME_LESS | Volume 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 Name | Description |
|---|---|
| STATE_UN_INIT | 0x0001 Uninitialized |
| STATE_INIT_SUCCESS | 0x0002 Initialized successfully |
| STATE_START | 0x0003 Streaming started |
| STATE_RUN | 0x0004 Streaming successful |
| STATE_STOP | 0x0005 Streaming stopped |
Get Message Channel Controller
Method:
ArmCloudEngine.getMessageChannel()
Return Value: Type:IMessageChannel Description:Message channel controller
IMessageChannel Methods:
| Method | Parameters | Description |
|---|---|---|
| setMessageListener(listener: IMessageReceiver?) | listener@IMessageReceiver: Message listener | Set 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 name | Send 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:
| Method | Parameters | Description |
|---|---|---|
| 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 listener | Lifecycle-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 listener | Lifecycle-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 listener | File 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 listener | File upload |
| cancelUpload(path: String) | path: File path | Cancel upload |
UploadFilePath:
| Field Name | Description |
|---|---|
| PATH_DCIM | DCIM directory |
| PATH_DOCUMENTS | Documents directory |
| PATH_DOWNLOAD | Download directory |
| PATH_MOVIES | Movies directory |
| PATH_MUSIC | Music directory |
| PATH_PICTURES | Pictures directory |
Get Local Keyboard and Cloud App Controller
Method:
ArmCloudEngine.getLocalInputManager()
Return Value: Type:ILocalInputManager Description:Local keyboard and cloud app controller
ILocalInputManager Methods:
| Method | Parameters | Description |
|---|---|---|
| sendInputText(text: String) | text: Text content | Send 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:
| Parameter | Type | Required | Description |
|---|---|---|---|
| path | String | Yes | Video path: URL or cloud file path |
| isLoop | Boolean | Yes | Loop playback |
| fileName | String | No | File name (required when path is URL) |
Video Requirements:
| Item | Requirement |
|---|---|
| Supported Formats | H.264, H.265 encoding |
| Resolution | Width 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")
}
})