Installing Applications on a Cloud Phone

Install applications on a cloud phone by referring to Installing the APK in the Cloud Phone API Reference.

Prerequisites

  • The required Android Package (APK) has been stored in the Object Storage Service (OBS) bucket in the region where the cloud phone server is located. (Upload the installation package by referring to Step 6: Uploading an Object.)
  • The OBS bucket policies have been configured based on Reading Data from an OBS Bucket.

Example API

POST https://{CPH Endpoint}/v1/{project_id}/cloud-phone/phones/commands
Header:
Content-Type: application/json
X-Auth-Token: ${token}
Body:
{
    "command": "install",
    "content": "-t -r obs://{bucket_name}/{object_path}",
    "phone_ids": [
        "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
    ]
}

Parameter descriptions:

  • Obtain the values of parameters such as CPH Endpoint, project_id, and ${token} by referring to Querying Cloud Phones.
  • bucket_name indicates the OBS bucket name, and object_path indicates the path for storing the application installation package.
  • phone_ids indicates the ID of the cloud phone on which the application is to be installed. (Obtain the cloud phone ID by referring to Querying Cloud Phones. You can enter multiple cloud phone IDs, and the application will be installed on multiple cloud phones.)

API Calling Example

POST https://cph.cn-east-3.myhuaweicloud.com/v1/081ceeb7fb800f0c2f4cc004bb39c2f7/cloud-phone/phones/commands 
Content-Type: application/json
X-Auth-Token: ${token}
{ 
    "command": "install", 
    "content": "-t -r obs://yzw-apk-install/apk/com.hermes.bgame.apk", 
    "phone_ids": [ 
        "bdc2f2e960164dd9a2765374afeea300" 
    ] 
}
  • yzw-apk-install is the OBS bucket name, apk/com.hermes.bgame.apk is the path of the application installation package, and obs://yzw-apk-install/apk/com.hermes.bgame.apk is the full path of the application installation package.
  • Replace ${token} with the actual token.