Environmental Requirements
Android 5.0 or above is a genuine Android device or emulator
IDE: Android Studio (latest version recommended)
The JDK version requires 1.8+
Add Maven repository address
- In the repositories section of the build.gradle file in the Project root directory, configure the Maven repository address, referring to the following example:
repositories {
maven {
url "https://maven.vmos.cn"
}
}
}
- Import ArmCloudSDK into the project's build.gradle file:
implementation "net.armcloud.armcloudsdk:armcloudsdkv3:1.1.4"
- Set Java version to 1.8, referring to the following example:
android {
// ...
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
Permission Statement
Declare the permissions required by the SDK in the AndroidManifest.xml file based on the actual scenario, referring to the following example:
<!--Used to access the network, network location requires internet access-->
<uses-permission android:name="android.permission.INTERNET"/>
<!--WiFi network status, usage scenario: monitoring changes in the user's mobile phone network status-->
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<!--Used for network positioning-->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<!--Used to access GPS positioning-->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<!--Used to collect audio information-->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<!--Used to collect video information-->
<uses-permission android:name="android.permission.CAMERA" />
<!--Used for vibration control-->
<uses-permission android:name="android.permission.VIBRATE" />
<!--File read/write permissions: Used for uploading files-->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<!--File management permissions (Android 11 (API level 30) and above) are used to upload files-->
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
Get Started Quickly
Initialization
Call the prepare method to initialize ArmCloudEngine:
ArmCloudEngine.prepare(this, object : ICloudCoreManagerStatusListener {
override fun onPrepared() {
Log.i("ArmCloudEngine", "Initialization complete")
}
})
Configure PhonePlayConfig
Parameters required to configure and launch the cloud phone:
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 hold the Container for the screen
.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) // Optional parameters, clarity level ID, default is HD
.enableGyroscopeSensor(enableGyroscopeSensor) // Optional parameters: Turn on gyroscope switch. Default is 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(isEnable) // Optional parameters: Open cloud phone clipping panel to sync to real machine. Default is true
.enableClipboardLocalPhoneSync(isEnable) // Optional parameters: Open real machine clipboard to sync to cloud phone. Default is true
.enableCamera(isEnable) // Optional parameters: Enable camera permissions. Default: true
.enableMic(isEnable) // 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(autoRecycleTime) // Optional parameter Specify no operation recovery time Unit s default 300s
val phonePlayConfig: PhonePlayConfig = builder.build()
Starting the Cloud Phone
Call the start interface to start the cloud phone:
ArmCloudEngine.start(phonePlayConfig, IPlayerListener playerListener)