API interface description
This document describes the interface provided by the Cloud Phone Android client SDK.
You can also refer to the [Example Project] (/ArmCloudSdkDemo_android.zip) to learn more about the complete project implementation.
API Overview
Initialization
| Method name | Method description |
|---|---|
| [prepare] (./android-sdk.md#initialize-armcloudengine) | Initialize ArmCloudEngine |
Status
| variable name | Variable description |
|---|---|
| [engineState] (./android-sdk.md#get-engine-status) | Get the current engine status |
Life cycle
| Method name | Method description |
|---|---|
| [start] (./android-sdk.md#starting-the-cloud-machine) | Start the cloud phone |
| [resume] (./android-sdk.md#restore-traffic-pulling-from-cloud-machines) | Recovery from cloud phone streaming pulling |
| [pause] (./android-sdk.md#pausing-streaming-from-cloud-machines) | Pause streaming from cloud phones |
| [stop] (./android-sdk.md#stop-the-cloud-machine) | Stop the cloud phones |
| [onRequestPermissionsResult] (./android-sdk.md#permission-handling) | Permission is handled automatically |
Function control
| Method name | Method description |
|---|---|
| [screenShot] (./android-sdk.md#screenshot) | Screenshot |
| [videoStreamProfileId] (./android-sdk.md#set-cloud-machine-clarity) | Set cloud phone clarity |
| [rotate] (./android-sdk.md#rotate-the-local-screen-direction) | Rotate the local screen direction |
| [muteAudio] (./android-sdk.md#whether-to-disable-audio) | Whether to disable audio |
| [muteVideo] (./android-sdk.md#should-videos-be-banned) | Whether to disable video |
| [enableLocalKeyboard] (./android-sdk.md#whether-to-enable-the-local-keyboard) | Whether to enable the local keyboard |
| [enableLocationService] (./android-sdk.md#whether-to-enable-location-tracking) | Whether to enable location functions |
| [enableGyroscopeSensor] (./android-sdk.md#whether-sensor-functionality-is-enabled) | Whether gyroscope functionality is enabled |
| [enableAccelerometerSensor] (./android-sdk.md#whether-to-enable-gravity-sensing) | Whether to enable gravity sensing |
| [enableVibrator] (./android-sdk.md#whether-to-enable-vibration-function) | Whether vibration is enabled |
| [enableCamera] (./android-sdk.md#camera-permissions) | Camera permissions |
| [enableMic] (./android-sdk.md#microphone-permissions) | Microphone permissions |
| [setLocationServiceMode] (./android-sdk.md#set-the-location-mode) | Set the positioning mode |
| [getLocationServer] (./android-sdk.md#accessing-location-services) | Access location services |
| [getClipBoardServiceManager] (./android-sdk.md#obtain-the-shear-plate-controller) | Get the shearboard controller |
| [switchCamera] (./android-sdk.md#switch-between-front-and-rear-cameras) | Switch between front and rear cameras |
| [sendKeyEvent] (./android-sdk.md#send-simulated-key-events) | Send simulated key events |
| [autoRecycleTime] (./android-sdk.md#set-the-time-for-no-operation-to-reclaim-services) | Set the non-operation recovery service time: default is 300s |
| [getAutoRecycleTime] (./android-sdk.md#obtaining-the-no-operation-recovery-service-time) | Obtain no-action recovery service time |
| [streamType] (./android-sdk.md#set-the-pull-type) | Set pull type: pull video/audio |
| [updateVideoRenderMode] (./android-sdk.md#updated-video-streaming-rendering-mode) | Updated video streaming rendering mode |
| [setVideoRotationMode] (./android-sdk.md#set-video-rotation-mode) | Set the video rotation mode |
| [getStatus] (./android-sdk.md#get-the-current-playback-status) | Get the current playback status |
| [getMessageChannel] (./android-sdk.md#get-message-passthrough-controller) | Obtain message transparency controller |
| [getUploadManager] (./android-sdk.md#obtain-the-file-upload-controller) | Obtain the file upload controller |
| [getLocalInputManager] (./android-sdk.md#obtain-the-local-keyboard-and-cloud-computing-application-controller) | Obtain the local keyboard and cloud computing application controller |
| [startCaptureVideo] (./android-sdk.md#start-local-video-capture) | Start local video capture |
| [startCaptureAudio] (./android-sdk.md#start-local-audio-capture) | Start local audio capture |
| [stopCaptureVideo] (./android-sdk.md#stop-local-video-capture) | Stop local video capture |
| [stopCaptureAudio] (./android-sdk.md#stop-local-audio-capture) | Stop local audio capture |
| [startInjectVideoStream] (./android-sdk.md#start-video-injection) | Start video injection |
| [stopInjectVideoStream] (./android-sdk.md#stop-video-injection) | Stop video injection |
| [getVideoInjectState] (./android-sdk.md#get-video-injection-status) | Obtain video injection status |
Set up monitoring
| Method name | Method description |
|---|---|
| [setStreamProfileChangeListener] (./android-sdk.md#set-clarity-toggle-callback-monitoring) | Set clarity toggle playback monitoring |
| [setAutoRecycleTimeCallback] (./android-sdk.md#set-callback-listeners-for-the-duration-of-no-operation-recovery-service) | Set callback listeners for no operation recovery service duration |
| [setScreenShotCallBack] (./android-sdk.md#set-up-local-screenshot-callback-listening) | Set up local screenshot callback monitoring |
| [setLocationEventListener] (./android-sdk.md#set-up-location-callback-listening) | Set up location callback listening |
| [setExecuteAdbCommandCallback] (./android-sdk.md#set-up-callback-monitoring-for-adb-instruction-execution-results) | Set up callback listener for ADB instruction execution results |
| [setInjectVideoListener] (./android-sdk.md#set-up-video-injection-callback-monitoring) | Set up video injection callback monitoring |
API Details
Initialization
Initialize ArmCloudEngine
Method:
ArmCloudEngine.prepare(mContext: Application, cloudCoreManagerStatusListener: ICloudCoreManagerStatusListener)
Specifications: mContext: The context object for the application cloudCoreManagerStatusListener: Initializes callbacks
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 Status
Variable Name:
ArmCloudEngine.engineState
Variable Description: Type: int@EngineState Description: Current engine status EngineState :
| field name | Description |
|---|---|
| STATE_AVAILABLE | The engine is available |
| STATE_UN_AVAILABLE | The engine is unavailable |
Note: Before calling the start method, please ensure the engine status is available
Life cycle
Starting the cloud phone
Method:
ArmCloudEngine.start(config PhonePlayConfig, playerListener IPlayerListener)
Specifications: config: Initial configuration information playerListener: Pull streaming playback status for monitoring
The config field is described as follows:
| field name | Field type | Is it required? | Field description |
|---|---|---|---|
| context | FragmentActivity | Yes | Current Activity context |
| token | String | Yes | Request to add a room voucher |
| userId | String | Yes | User ID |
| clientType | String | Yes | Client type |
| padCode | String | Yes | Cloud-based streaming code |
| container | ViewGroup | Yes | The screen shows the container |
| enableMultiControl | boolean | No | Whether to enable group control |
| padCodes | List | No | Group control cloud phone numbering set |
| videoStreamProfileId | int | No | Clarity: default is HD |
| enableGyroscopeSensor | boolean | No | Whether sensor functionality is enabled |
| enableAccelerometerSensor | boolean | No | Whether to enable gravity sensing |
| enableVibrator | boolean | No | Whether vibration is enabled |
| enableLocationService | boolean | No | Whether location services are enabled |
| enableLocalKeyboard | boolean | No | Whether to enable the local keyboard feature |
| enableClipboardCloudPhoneSync | boolean | No | Whether to enable cloud phone clipping board synchronization to the real machine |
| enableClipboardLocalPhoneSync | boolean | No | Whether to enable real-machine clipping board synchronization with cloud phone |
| enableCamera | boolean | No | Whether camera permissions are enabled |
| enableMic | boolean | No | Whether to enable microphone permissions |
| autoRecycleTime | int | No | Service stops automatically after timeout: default 300s |
| streamType | String@StreamType | No | Streaming type: By default, it pulls audio and video |
| remoteLocationMock | LocationInfo | No | Location information |
| rotation | String@ScreenRotationType | No | Local screen rotation direction: default is portrait |
| videoRenderMode | int@VideoRenderMode | No | Video streaming rendering mode: default is adaptive |
| videoRotationMode | int@VideoRotationMode | No | Screen rotation mode: By default, external rotation is handled |
| streamListener | IStreamListener | No | Video streaming monitoring |
Field Type Information: StreamType:
| field name | Description |
|---|---|
| TYPE_VIDEO | Video |
| TYPE_AUDIO | Audio |
| TYPE_BOTH | Audio and video |
ScreenRotationType:
| field name | Description |
|---|---|
| TYPE_LANDSCAPE | Landscape screen |
| TYPE_PORTRAIT | Vertical screen |
VideoRenderMode:
| field name | Description |
|---|---|
| VIDEO_RENDER_MODE_COVER | The short edge of the image fills the container |
| VIDEO_RENDER_MODE_FIT | The screen scales are centered and displayed in the Container |
| VIDEO_RENDER_MODE_FILL | Non-scaling stretches and fills the entire container |
VideoRotationMode:
| field name | Description |
|---|---|
| EXTERNAL | EXTERNAL external rotation, default value; In this mode, users need to monitor IStreamListener#onRotation(int) to adjust the page orientation from outside to synchronize the screen direction with the Cloud Phone instance |
| INTERNAL | INTERNAL, internal rotation; In this mode, the SDK handles image orientation internally, and no external orientation processing is required |
Streaming ConnectionState :
| field name | Value | Description |
|---|---|---|
| CONNECTION_STATE_DISCONNECTED | 1 | If the connection is disconnected for more than 12 seconds, the SDK will attempt to automatically reconnect. |
| CONNECTION_STATE_CONNECTING | 2 | The first request to establish a connection is currently being connected. |
| CONNECTION_STATE_CONNECTED | 3 | The first connection was successful. |
| CONNECTION_STATE_RECONNECTING | 4 | Covers the following situations: failure to connect successfully within 10 seconds during the first connection; After a successful connection, disconnect for 10 seconds. Automatic reconnection. |
| CONNECTION_STATE_RECONNECTED | 5 | After the connection is disconnected, reconnection is successful. |
| CONNECTION_STATE_LOST | 6 | Stayed in CONNECTION_STATE_DISCONNECTED state for more than 10 seconds, and failed to reconnect during that period. The SDK will continue to attempt reconnection. |
| CONNECTION_STATE_FAILED | 7 | Connection failed, server status abnormal. The SDK will not reconnect automatically. Please re-enter the room or contact technical support. |
P2P ConnectionState :
| field name | Value | Description |
|---|---|---|
| STATE_NEW | 10 | Initialization |
| STATE_CHECKING | 11 | Connecting |
| STATE_CONNECTED | 3 | Connection successful |
| STATE_FAILED | 7 | Connection failed |
| STATE_COMPLETED | 14 | Connection complete. |
| STATE_DISCONNECTED | 15 | The connection is disconnected |
| STATE_CLOSED | 16 | Connection closed |
Sample Code:
val builder: PhonePlayConfig.Builder = PhonePlayConfig.Builder()
builder.context(this)
.userId(dto.userId) //Required parameter Custom client user ID
.padCode(dto.padCode) // Required parameter: Cloud Phone instance ID
.token(dto.token) // Required parameters: temporary authentication token
.clientType(dto.clientType) //Required parameter Client type
.container(container) // Required parameter, used to host the Container for the screen. Parameter description: layout needs to be a subclass of FrameLayout or FrameLayout
.enableMultiControl(isMultiControl) // Optional parameters: Whether to enable group control
.setPadCodes(mChosePadCodes) // Optional parameters: group control device number collection
.rotation(rotation) // Select the parameters: Landscape and portrait screen, default portrait
.videoStreamProfileId(
videoStreamProfileId.definition,
videoStreamProfileId.frameRate,
videoStreamProfileId.bitrate
) // Optional parameters, clarity level ID, default is HD
.enableGyroscopeSensor(enableGyroscopeSensor) // Optional parameters: Turn on gyroscope switch. Default is false
.enableAccelerometerSensor(enableAccelerometerSensor) // Optional parameter: Turn on gravity sensor switch default false
.enableVibrator(enableVibrator) // Optional parameter Turn on local vibration switch Default is false
.enableLocationService(enableLocationService) // Optional parameter Enable local location function switch Default false
.enableLocalKeyboard(enableLocalKeyboard) // Optional parameter Turn on local keyboard switch Default false
.enableClipboardCloudPhoneSync(enableCloudSync) // Optional parameters: Open cloud phone clipping panel to sync to real machine. Default is true
.enableClipboardLocalPhoneSync(enableLocalSync) // Optional parameters: Open real machine clipboard to sync to cloud phone. Default is true
.enableCamera(enableCamera) // Optional parameters: Enable camera permissions. Default: true
.enableMic(enableMic) // Optional parameters: Enable microphone permissions. Default: false
.streamType(streamType) // Optional parameters: Specify the type of audio and video stream to be pulled when launching the cloud phone. By default, it pulls audio and video streams
.videoRenderMode(renderMode) // Optional parameters: Specify video stream rendering mode. Default scaling and centering mode
.videoRotationMode(videoRotationMode) // Optional parameters: Specify video rotation mode. By default, non-SDK rotation is handled
.autoRecycleTime(autoRecyclerTime.toInt())
// Obtain audio and video stream information for callback monitoring
.streamListener(object : IStreamListener {
override fun onFirstAudioFrame(uid: String) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Subscribe to video streaming until the first frame of audio is received",
Toast.LENGTH_SHORT
).show()
}
}
override fun onRemoteAudio(byteBuffer: ByteBuffer) {
}
override fun onFirstRemoteVideoFrame(uid: String, width: Int, height: Int) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Subscribe to video streaming until the first frame of the video is received",
Toast.LENGTH_SHORT
).show()
}
}
override fun onVideoSizeChanged(uid: String, width: Int, height: Int) {
}
override fun onStreamPaused() {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Calls pause(), the callback after pausing playback",
Toast.LENGTH_SHORT
).show()
}
}
override fun onStreamConnectionStateChanged(state: Int, reason: Int) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Video stream connection status change callback state: $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, "Successfully pulling traffic", 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,
"Received a clipboard message: $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("Group control user joining")
}
}
override fun onMultiCloudPhoneLeave(padCode: String) {
runOnUiThread {
ToastUtils.showShort("Group control users to leave")
}
}
})
Restore traffic pulling from cloud phones
Method:
ArmCloudEngine.resume()
Code Example:
override fun onResume() {
super.onResume()
ArmCloudEngine.resume()
}
Pausing streaming from cloud phones
Method:
ArmCloudEngine.pause()
Code Example:
override fun onPause() {
super.onPause()
ArmCloudEngine.pause()
}
Stop the cloud phone
Method:
ArmCloudEngine.stop()
Code Example:
override fun onDestroy() {
super.onDestroy()
ArmCloudEngine.stop()
}
Permission handling
Method:
ArmCloudEngine.onRequestPermissionsResult(requestCode, permissions, grantResults)
Code Example:
overridefunonRequestPermissionsResult(
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)
Specifications: screenShotType: Screenshot type
| field name | Description |
|---|---|
| TYPE_LOCAL | Screenshot to the local location |
| TYPE_CLOUD | Screenshot to the cloud phone |
Set cloud phone clarity
Method 1:
ArmCloudEngine.videoStreamProfileId(videoDefinitionEnum: VideoDefinitionEnum)
Specifications: VideoDefinitionEnum :
| field name | Description |
|---|---|
| DEFINITION_B | Blu-ray |
| DEFINITION_S | Ultra clear |
| DEFINITION_H | High definition |
| DEFINITION_L | Clear definition |
Method 2:
ArmCloudEngine.videoStreamProfileId(definition: String, frameRateId: String, bitrateId: String)
Specifications: definition: clarity frameRateId: Frame rate bitrateId: Bitrate
| field name | Description |
|---|---|
| Clarity | 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 |
| Bit rate | 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 the local screen direction
Method:
ArmCloudEngine.rotate(ScreenRotationType.TYPE_LANDSCAPE)
Specifications: Set the rotation direction of the device in the same way as PhonePlayConfig
Whether to disable audio
Method:
ArmCloudEngine.muteAudio(isMetuAudio)
Specifications: isMetuAudio: Whether to disable audio true: Disabled false: Enabled
Should videos be banned?
Method:
ArmCloudEngine.muteVideo(isMetuVideo)
Specifications: isMetuVideo: Whether to disable video true: Disabled false: Enabled
Whether to enable the local keyboard
Method:
ArmCloudEngine.enableLocalKeyboard(isEnable)
Specifications: isEnable: Whether to enable the local keyboard true: Enable false: Disabled
Whether to enable location tracking
Method:
ArmCloudEngine.enableLocationService(isEnable)
Specifications: isEnable: Whether to enable location features true: Enable false: Disabled
Whether to enable the gyroscope function
Method:
ArmCloudEngine.enableGyroscopeSensor(isEnable)
Specifications: isEnable: Whether sensor functionality is enabled true: Enable false: Disabled
Whether to enable gravity sensing
Method:
ArmCloudEngine.enableAccelerometerSensor(isEnable)
Specifications: isEnable: Whether to enable gravity sensing true: Enable false: Disabled
Whether to enable vibration function
Method:
ArmCloudEngine.enableVibrator(isEnable)
Specifications: isEnable: Whether vibration is enabled true: Enable false: Disabled
Camera permissions
Method:
ArmCloudEngine.enableCamera(isEnable)
Specifications: isEnable: Whether camera permission is enabled true: Enable false: Disabled
Microphone permissions
Method:
ArmCloudEngine.enableMic(isEnable)
Specifications: isEnable: Whether to enable microphone permissions true: Enable false: Disabled
Set the location mode
Method:
ArmCloudEngine.setLocationServiceMode(mode@LocationMode)
Specifications: mode: Positioning mode
| field name | Description |
|---|---|
| MODE_AUTO | Automatic mode: SDK automatically captures and locates positioning |
| MODE_MANUAL | Manual mode: Set setLocationEventListener(locationEventListener: LocationEventListener) to listen Manually incoming the location via remoteLocationMock |
Accessing location services
Method:
ArmCloudEngine.getLocationServer()
Return Value: Type: ILocationService Description: Location services
ILocationService
| Method | Parameters | Description |
|---|---|---|
| enableLocationService(isEnable: Boolean) | isEnable: Is it enabled? | Whether location is enabled |
| 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 information |
| 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: height bearing: azimuth accuracy: horizontal accuracy radius (in meters) speed: speed at this position (in meters per second time: Unix epoch time fixed at this location elapsedRealtimeNanos: The time of this fix (measured in real-time nanoseconds elapsed since system startup) satellites: Number of satellites | Set location information |
Obtain the shear plate controller
Method:
ArmCloudEngine.getClipBoardServiceManager()
Return Value: Type: IClipBoardServiceManager Description: Clipboard service
IClipBoardServiceManager
| Method | Parameters | Description |
|---|---|---|
| setBoardSyncClipListener(iClipBoardListener) | iClipBoardListener@IClipBoardListener: Cloud machine clipboard data monitoring | Set up cloud phone clipboard data monitoring |
| sendClipBoardMessage(data: String) | data: text data | Manually send clipboard data |
| enableClipboardLocalPhoneSync(isEnable: Boolean) | isEnable: Whether to enable it | Whether to enable the shear board real machine synchronization with the cloud phone |
| enableClipboardCloudPhoneSync(isEnable: Boolean) | isEnable: Whether to enable it | Whether to enable the clipboard cloud phone to sync with the real machine |
Switch between front and rear cameras
Method:
ArmCloudEngine.switchCamera(isBack)
Specifications: isBack: Is it a rear camera? true: Post-installed false: prefix
Send simulated key events
Method:
ArmCloudEngine.sendKeyEvent(systemKeyStrokeEnum SystemKeyStrokeEnum)
Specifications: systemKeyStrokeEnum: Enumeration of keys
| listing their names one by one | Description |
|---|---|
| BACK | Return key |
| HOME | Home |
| JOB | Taskbar |
| MENU | Menu |
| VOLUME_ADD | Volume increases |
| VOLUME_LESS | Volume decreased |
Set the time for no operation to reclaim services
Method:
ArmCloudEngine.autoRecycleTime(recycleTime)
Specifications: recycleTime: No operation to recover service time in units s
Obtaining the No-Operation Recovery Service Time
Method:
ArmCloudEngine.getAutoRecycleTime()
Return Value: Type: int Description: No operation recovery service time Unit s
Set the pull type
Method:
ArmCloudEngine.streamType(streamType)
Specifications: Set the pull type with PhonePlayConfig
Updated video streaming rendering mode
Method:
ArmCloudEngine.updateVideoRenderMode(renderMode)
Specifications: Set the video stream rendering mode with PhonePlayConfig
Set Video Rotation Mode
Method:
ArmCloudEngine.setVideoRotationMode(rotationMode)
Specifications: Set the video rotation mode with PhonePlayConfig
Get the current playback status
Method:
ArmCloudEngine.getStatus()
Return Value: Type: int@CloudPhoneState Description: Current playback status CloudPhoneState :
| field name | Description |
|---|---|
| STATE_UN_INIT | 0x0001 Not initialized |
| STATE_INIT_SUCCESS | 0x0002 Initialization successful |
| STATE_START | 0x0003 Call the pull stream |
| STATE_RUN | 0x0004 Successfully pull traffic |
| STATE_STOP | 0x0005 Stop pulling the flow |
Get message passthrough controller
Method:
ArmCloudEngine.getMessageChannel()
Return Value: Type: IMessageChannel Description: Message propagation controller
IMessageChannelMethod:
| Method | Parameters | Description |
|---|---|---|
| setMessageListener(listener: IMessageReceiver?) | listener@IMessageReceiver: Message Transmission Monitoring | Set up message passthrough listening, pullback messages from cloud phones to the real machine |
| sendMessage(type: Int, data: String, binderService: String, packageName: String) | type: Message type data: Message body binderService: Remote service name packageName: Package name | Send transparent messages to designated services within the cloud phone |
Obtain the file upload controller
Method:
ArmCloudEngine.getUploadManager(application)
Specifications: application: Global context
Return Value: Type: IUploadFileManager Description: File upload controller
IUploadFileManagerMethod:
| Method | Parameters | Description |
|---|---|---|
| uploadFile(lifecycleOwner: LifecycleOwner, padCode: String, token: String, path: String, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack ) | lifecycleOwner: Lifecycle owner padCode: Cloud server ID token: Temporary authentication token path: File path uploadFilePath@UploadFilePath: Saved file cloud phone path uploadFileCallBack@IUploadFileCallBack: File upload monitoring | Upload files with lifecycles |
| uploadFile(lifecycleOwner: LifecycleOwner, padCode: String, token: String, file: File, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack ) | lifecycleOwner: Lifecycle Owner padCode: Cloud Phone ID token: Temporary authentication token file: File to be uploaded uploadFilePath@UploadFilePath: Save the file to the cloud phone path uploadFileCallBack@IUploadFileCallBack: File upload monitoring | Upload files with lifecycles |
| uploadFile(padCode: String, token: String, path: String, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack ) | padCode: Cloud Phone ID token: Temporary authentication token path: File path uploadFilePath@UploadFilePath: File storage cloud phone path uploadFileCallBack@IUploadFileCallBack: File upload monitoring | File upload |
| uploadFile(padCode: String, token: String, file: File, uploadFilePath: String, uploadFileCallBack: IUploadFileCallBack ) | padCode: Cloud Phone ID token: Temporary authentication token file: File to be uploaded uploadFilePath@UploadFilePath: Save the cloud phone path uploadFileCallBack@IUploadFileCallBack: File upload monitoring | File upload |
| cancelUpload(path: String) | path: File path | Cancel uploading |
UploadFilePath:
| field name | Description |
|---|---|
| PATH_DCIM | DCIM directory |
| PATH_DOCUMENTS | Documents directory |
| PATH_DOWNLOAD | Download the directory |
| PATH_MOVIES | Movies Directory |
| PATH_MUSIC | Music catalog |
| PATH_PICTURES | Pictures catalog |
Obtain the local keyboard and cloud computing application controller
Method:
ArmCloudEngine.getLocalInputManager()
Return Value: Type: ILocalInputManager Description: Obtain the local keyboard and cloud computing application controller
ILocalInputManagerMethod:
| Method | Parameters | Description |
|---|---|---|
| sendInputText(text: String) | text: message content | Send messages to the cloud phone input box |
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?)
Specifications:
| Parameter name | Type | Is it required? | Description |
|---|---|---|---|
| path | String | Yes | Video path: URL / video file path within the cloud phone |
| isLoop | Boolean | Yes | Is it a cycle? |
| fileName | String | No | If the file name path is of URL type, it must be passed |
Video Requirements:
| Name | Requirements |
|---|---|
| Supported video formats | H.264 and H.265 codes |
| Video resolution | The width and height must be a multiple of 2 |
Stop video injection
Method:
ArmCloudEngine.stopInjectVideoStream()
Get video injection status
Method:
ArmCloudEngine.getVideoInjectState()
Description: Video injection status callbacks are obtained in @IInjectVideoListener
Event Monitoring
Set Clarity Toggle Callback Monitoring
Method:
setStreamProfileChangeListener(streamProfileChangeCallBack StreamProfileChangeCallBack)
Specifications: streamProfileChangeCallBack: Clarity switch callback interface
Sample Code:
ArmCloudEngine.setStreamProfileChangeListener(object:StreamProfileChangeCallBack{
overridefunonVideoStreamProfileChange(
isSuccess:Boolean,
from:String,
current:String
){
runOnUiThread{
Toast.makeText(
this@MainActivity,
"Clarity switching successfully from:$fromto:$current",
Toast.LENGTH_SHORT
).show()
}
}
})
Set callback listeners for the duration of no operation recovery service
Method:
setAutoRecycleTimeCallback(autoRecycleTimeCallback SetAutoRecycleTimeCallback)
Specifications: autoRecycleTimeCallback: A callback for the duration of the service without any operation to reclaim the service
Sample Code:
ArmCloudEngine.setAutoRecycleTimeCallback(object : SetAutoRecycleTimeCallback {
override fun onResult(autoRecycleTime: Int) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"No operation recovery service callback Timeout: $autoRecycleTime",
Toast.LENGTH_SHORT
).show()
}
}
})
Set up local screenshot callback listening
Method:
setScreenShotCallBack(screenShotCallBack: ScreenShotCallBack)
Specifications: ScreenShotCallBack: Local screenshot monitoring
Sample Code:
ArmCloudEngine.setScreenShotCallBack(object : ScreenShotCallBack {
override fun onScreenShot(bitmap: Bitmap) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Local screenshot retrieved: ${bitmap.byteCount}",
Toast.LENGTH_SHORT
).show()
}
}
})
Set up location callback listening
Method:
setLocationEventListener(locationEventListener: LocationEventListener)
Specifications: locationEventListener: Location listening
Sample Code:
ArmCloudEngine.setLocationEventListener(object: LocationEventListener {
override fun onReceivedRemoteLocationRequest(requestOptions: RequestOptions) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Cloud device requests to enable location",
Toast.LENGTH_SHORT
).show()
}
}
override fun onRemoteLocationRequestEnded() {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"The cloud phone requests to stop positioning",
oast.LENGTH_SHORT
).show()
}
}
override fun onSentLocalLocation(locationInfo: LocationInfo) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"The machine sends the location",
Toast.LENGTH_SHORT
).show()
}
}
override fun onRemoteLocationUpdated(locationInfo: LocationInfo) {
runOnUiThread {
Toast.makeText(
this@MainActivity,
"Cloud machine location updates",
Toast.LENGTH_SHORT
).show()
}
}
})
Set up callback monitoring for ADB instruction execution results
Method:
setExecuteAdbCommandCallback(iExecuteAdbCommandCallback: IExecuteAdbCommandCallback)
Specifications: iExecuteAdbCommandCallback: Executes the Adb instruction result callback
Sample Code:
ArmCloudEngine.setExecuteAdbCommandCallback(object : IExecuteAdbCommandCallback {
override fun onExecuteAdbCommandResult(isSuccess: Boolean, content: String) {
ToastUtils.showShort("Successfully executed adb instruction isSuccess: $isSuccess resultMsg: $content")
Log.e(
TAG,
"onExecuteAdbCommandResult isSuccess ===> $isSuccess content ===> $content"
)
}
})
Set up video injection callback monitoring
Method:
setInjectVideoListener(iInjectVideoListener: IInjectVideoListener)
Specifications: 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")
}
})