Help Center/ Cloud Phone Host/ Best Practices/ Using the Cloud Phone Camera
Updated on 2023-12-25 GMT+08:00

Using the Cloud Phone Camera

Step 1: Replace the Image of a Cloud Phone

  1. View AOSP 7 Cloud Phone Image Change History, select an image released on or after October 9, 2020, and copy the image ID.
  2. Log in to the management console, switch to the region where your resources are deployed, and choose Compute > Cloud Phone Host.

  3. Choose Servers to view servers.

  1. Click the name of a server to go to the server details page, select a cloud phone, and click Restart.

  2. Select the Update Phone Image checkbox and enter the image ID selected in 1.

  1. Click OK.

Step 2: Upload a Picture to the Cloud Phone

Upload a picture to the /data/local/tmp/ directory of the cloud phone in either of the following ways. The following uses pic.jpeg in the /path/to/local directory as an example.

  • Method 1: Run the adb push command to push the picture.

    Connect to the cloud phone through ADB, and run the following commands:

    adb push </path/to/local/pic.jpeg> /data/local/tmp/pic.jpeg

    adb shell chmod 644 /data/local/tmp/pic.jpeg

  • Method 2: Call the CPH API to push the picture.

    See Pushing Files.

  • The size of the picture to be uploaded must be 480 (width) x 640 (height). If the size is not 480 x 640, the picture may be zoomed in or out on the camera.
  • Only JPEG and PNG pictures stored in the /data/local/tmp/ path are supported.
  • Picture permissions must be at least 644 (rw-r--r--).

Step 3: Configure Cloud Phone Attributes

You can configure cloud phone attributes in either of the following ways:

Method 1: Use ADB to connect to the cloud phone and run the adb command.

adb shell setprop com.cph.cam_local_pic_path /data/local/tmp/pic.jpeg

If you use this method, the cloud phone attributes become invalid after the cloud phone is restarted.

Method 2: Call the CPH API to configure attributes.

Set com.cph.cam_local_pic_path to /data/local/tmp/pic.jpeg for the cloud phone. For details, see Updating Cloud Phone Attributes. The attributes will always be valid even after the cloud phone is restarted.

Step 4: Test the Camera

Install an application that needs to use the camera, open the application, and check whether the picture you uploaded is displayed in the viewfinder.

CPH supports only the rear camera.