ARMCLOUD Documentation Center
  • 简体中文
  • English
  • 简体中文
  • English
  • Product introduction
  • Product billing
  • Server OpenAPI
    • Usage Guide
    • API Signature v1.0
    • API Reference
    • Error Codes
    • Callback Business Type Codes
    • Instance List
    • Android Instance Property List
    • Changelog
  • Android SDK
    • Example Setup
    • Interface Description
    • Callback Function
    • Error Code
    • Changelog
  • Web H5 SDK
    • Example Setup
    • Interface Description
    • Callback Function
    • Error Code
    • Changelog
  • Windows PC SDK
    • Example Setup
    • Interface Description
    • Callback Function
    • Changelog
  • Edge-Cloud Communication Development
    • AIDL Access Method
    • System Service API (AIIDL)
  • Scenario solutions
    • XP-like LSP Hook framework
    • Dynamic simulation of sensor data
  • ADI Collection Tool
  • FAQ
    • Platform Basics
    • Storage
    • Network Connectivity
    • Application Management
    • Development and Integration
    • Performance Optimization
    • Billing
    • Technical Support
  • Related agreements
    • Cloud Phone SDK Privacy Policy

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 nameMethod description
[prepare] (./android-sdk.md#initialize-armcloudengine)Initialize ArmCloudEngine

Status

variable nameVariable description
[engineState] (./android-sdk.md#get-engine-status)Get the current engine status

Life cycle

Method nameMethod 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 nameMethod 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 nameMethod 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 nameDescription
STATE_AVAILABLEThe engine is available
STATE_UN_AVAILABLEThe 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 nameField typeIs it required?Field description
contextFragmentActivityYesCurrent Activity context
tokenStringYesRequest to add a room voucher
userIdStringYesUser ID
clientTypeStringYesClient type
padCodeStringYesCloud-based streaming code
containerViewGroupYesThe screen shows the container
enableMultiControlbooleanNoWhether to enable group control
padCodesListNoGroup control cloud phone numbering set
videoStreamProfileIdintNoClarity: default is HD
enableGyroscopeSensorbooleanNoWhether sensor functionality is enabled
enableAccelerometerSensorbooleanNoWhether to enable gravity sensing
enableVibratorbooleanNoWhether vibration is enabled
enableLocationServicebooleanNoWhether location services are enabled
enableLocalKeyboardbooleanNoWhether to enable the local keyboard feature
enableClipboardCloudPhoneSyncbooleanNoWhether to enable cloud phone clipping board synchronization to the real machine
enableClipboardLocalPhoneSyncbooleanNoWhether to enable real-machine clipping board synchronization with cloud phone
enableCamerabooleanNoWhether camera permissions are enabled
enableMicbooleanNoWhether to enable microphone permissions
autoRecycleTimeintNoService stops automatically after timeout: default 300s
streamTypeString@StreamTypeNoStreaming type: By default, it pulls audio and video
remoteLocationMockLocationInfoNoLocation information
rotationString@ScreenRotationTypeNoLocal screen rotation direction: default is portrait
videoRenderModeint@VideoRenderModeNoVideo streaming rendering mode: default is adaptive
videoRotationModeint@VideoRotationModeNoScreen rotation mode: By default, external rotation is handled
streamListenerIStreamListenerNoVideo streaming monitoring

Field Type Information: StreamType:

field nameDescription
TYPE_VIDEOVideo
TYPE_AUDIOAudio
TYPE_BOTHAudio and video

ScreenRotationType:

field nameDescription
TYPE_LANDSCAPELandscape screen
TYPE_PORTRAITVertical screen

VideoRenderMode:

field nameDescription
VIDEO_RENDER_MODE_COVERThe short edge of the image fills the container
VIDEO_RENDER_MODE_FITThe screen scales are centered and displayed in the Container
VIDEO_RENDER_MODE_FILLNon-scaling stretches and fills the entire container

VideoRotationMode:

field nameDescription
EXTERNALEXTERNAL 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
INTERNALINTERNAL, internal rotation; In this mode, the SDK handles image orientation internally, and no external orientation processing is required

Streaming ConnectionState :

field nameValueDescription
CONNECTION_STATE_DISCONNECTED1If the connection is disconnected for more than 12 seconds, the SDK will attempt to automatically reconnect.
CONNECTION_STATE_CONNECTING2The first request to establish a connection is currently being connected.
CONNECTION_STATE_CONNECTED3The first connection was successful.
CONNECTION_STATE_RECONNECTING4Covers 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_RECONNECTED5After the connection is disconnected, reconnection is successful.
CONNECTION_STATE_LOST6Stayed 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_FAILED7Connection failed, server status abnormal. The SDK will not reconnect automatically. Please re-enter the room or contact technical support.

P2P ConnectionState :

field nameValueDescription
STATE_NEW10Initialization
STATE_CHECKING11Connecting
STATE_CONNECTED3Connection successful
STATE_FAILED7Connection failed
STATE_COMPLETED14Connection complete.
STATE_DISCONNECTED15The connection is disconnected
STATE_CLOSED16Connection 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 nameDescription
TYPE_LOCALScreenshot to the local location
TYPE_CLOUDScreenshot to the cloud phone

Set cloud phone clarity

Method 1:

ArmCloudEngine.videoStreamProfileId(videoDefinitionEnum: VideoDefinitionEnum)

Specifications: VideoDefinitionEnum :

field nameDescription
DEFINITION_BBlu-ray
DEFINITION_SUltra clear
DEFINITION_HHigh definition
DEFINITION_LClear definition

Method 2:

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

Specifications: definition: clarity frameRateId: Frame rate bitrateId: Bitrate

field nameDescription
Clarity07: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
Bit rate01: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 nameDescription
MODE_AUTOAutomatic mode: SDK automatically captures and locates positioning
MODE_MANUALManual 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

MethodParametersDescription
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

MethodParametersDescription
setBoardSyncClipListener(iClipBoardListener)iClipBoardListener@IClipBoardListener: Cloud machine clipboard data monitoringSet up cloud phone clipboard data monitoring
sendClipBoardMessage(data: String)data: text dataManually send clipboard data
enableClipboardLocalPhoneSync(isEnable: Boolean)isEnable: Whether to enable itWhether to enable the shear board real machine synchronization with the cloud phone
enableClipboardCloudPhoneSync(isEnable: Boolean)isEnable: Whether to enable itWhether 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 oneDescription
BACKReturn key
HOMEHome
JOBTaskbar
MENUMenu
VOLUME_ADDVolume increases
VOLUME_LESSVolume 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 nameDescription
STATE_UN_INIT0x0001 Not initialized
STATE_INIT_SUCCESS0x0002 Initialization successful
STATE_START0x0003 Call the pull stream
STATE_RUN0x0004 Successfully pull traffic
STATE_STOP0x0005 Stop pulling the flow

Get message passthrough controller

Method:

ArmCloudEngine.getMessageChannel()

Return Value: Type: IMessageChannel Description: Message propagation controller

IMessageChannelMethod:

MethodParametersDescription
setMessageListener(listener: IMessageReceiver?)listener@IMessageReceiver: Message Transmission MonitoringSet 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:

MethodParametersDescription
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 pathCancel uploading

UploadFilePath:

field nameDescription
PATH_DCIMDCIM directory
PATH_DOCUMENTSDocuments directory
PATH_DOWNLOADDownload the directory
PATH_MOVIESMovies Directory
PATH_MUSICMusic catalog
PATH_PICTURESPictures 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:

MethodParametersDescription
sendInputText(text: String)text: message contentSend 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 nameTypeIs it required?Description
pathStringYesVideo path:
URL / video file path within the cloud phone
isLoopBooleanYesIs it a cycle?
fileNameStringNoIf the file name
path is of URL type, it must be passed

Video Requirements:

NameRequirements
Supported video formatsH.264 and H.265 codes
Video resolutionThe 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")
            }
        })
Prev
Example Setup
Next
Callback Function