Installing the APK
Function Description
- API Name
- Function
Install the APK on a cloud phone. The system downloads the specified APK file and installs it on the cloud phone. Only one APK can be installed at a time. This API is an asynchronous API. You can call APIs in Querying the Task Execution Status and Querying the Task Execution Status List to query the task execution result.
- Notes
You have granted the read-only permission on the OBS bucket to the Cloud Phone service system account. For details, see Managing Cloud Phones in Batches in the Cloud Phone User Guide.
The management plane performance is limited. Executing ADB commands in batches on the same server blocks the execution of other tasks on the cloud phone. You are advised to install the APK by developing an app store.
URI
POST /v1/{project_id}/cloud-phone/phones/commands
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
project_id |
Yes |
String |
Specifies the project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
Request
- Request parameters
Parameter
Mandatory
Type
Description
command
Yes
String
Specifies the ADB command. In the APK installation scenario, this parameter is fixed at install.
content
Yes
String
Specifies the APK file in the specified OBS bucket. (The APK file must be uploaded to the specified bucket in advance.)
The value can contain a maximum of 1024 bytes, including only uppercase letters, lowercase letters, digits, underscores (_), periods (.), slashes (/), colons (:), and hyphens (-).
Only .apk files can be pushed.
File format: obs://obs-bucket-name/obs-file-path/file.apk
server_ids
No
This parameter is mandatory when the phone_ids parameter does not exist.
Array of strings
Specifies the ID list of the Cloud Phone servers.
Obtain it from Querying the Cloud Phone Servers.
phone_ids
No
This parameter is mandatory when parameter server_ids does not exist.
Array of strings
Specifies the cloud phone ID list.
Obtain it from Querying the Cloud Phones.
- Example request
POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/commands { "command": "install", "content": "-t -r obs://push-bucket/my_apps/test.apk", "phone_ids": [ "1234567b8bab40ffb711234cb80d0234", "1678567b8bab40f93711234cb80d0764" ] }
Response
- Response parameters
Parameter
Type
Description
request_id
String
Specifies the request ID, which is unique.
jobs
Array of objects
Specifies the task information. For details, see Table 2.
- Example response
{ "request_id": "6837531fd3f54550927b930180a706bf", "jobs": [ { "phone_id": "1234567b8bab40ffb711234cb80d0234", "job_id": "1564567b8bab40f34711234cb80d0123" }, { "phone_id": "1678567b8bab40f93711234cb80d0764", "job_id": "1564567b8bab40f34711234cb80d5678" } ] }
Returned Values
See Returned Values.
Error Codes
See Error Codes.
Last Article: Pushing Files
Next Article: Uninstalling the APK
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.