VMOS Cloud API
  • 简体中文
  • English
  • 简体中文
  • English
  • Product Introduction
  • Product Type
  • Product Billing
  • OpenAPI
    • User Guide
    • API Documentation
    • Error Code
    • Instance Property List
    • Android device modification attribute list
    • Callback Task Business Type Codes
    • Changelog
  • Android SDK
    • Example Construction
    • API Documentation
    • Callback Functions
    • Error Code
    • Changelog
  • Web H5 SDK
    • Example Build
    • API Documentation
    • H5 SDK Callback Functions
    • Error Code
    • Change log
  • Windows PC SDK
    • Example Setup
    • API Documentation
    • Callback Functions
    • Changelog
  • Edge-Cloud Communication Development
    • AIDL Integration Method
    • System Service API (AIDL)
  • Similar to XP, LSP Hook framework

    • Xposed-like / LSPosed Framework
    • Sensor Data Dynamic Simulation
  • Related agreements

Below is the VMOSCLOUD Cloud Phone Sensor Dynamic Simulation Guide. This feature allows developers to provide realistic physical environment interactions for cloud phone applications by simulating real sensor data files.


1. Feature Overview

VMOSCLOUD cloud phones support dynamic data simulation for various mobile device sensors. By injecting predefined data files into the system, developers can simulate device motion, location, environmental changes, and biometric features. This is suitable for game testing, navigation simulation, health app development, and more.


2. Supported Sensor Types and Format Details

For easy reference, sensors are divided into four major categories. Use the corresponding format string in the data file.

2.1 Motion & Pose Sensors

Sensor NameIdentifier (Key)Data FormatUnitUse Case
Accelerometeraccelerationx:y:zm/s²Gravity games, screen rotation
Linear Accelerationlinear-accelerationx:y:zm/s²Gesture recognition (gravity removed)
Uncalibrated Accelerometeracceleration-uncalibratedx:y:zm/s²Raw data analysis
Gyroscopegyroscopex:y:zrad/s3D games, VR/AR
Uncalibrated Gyroscopegyroscope-uncalibratedx:y:zrad/sRaw angular velocity data
Gravity Sensorgravityx:y:zm/s²Level tool, attitude detection
Rotation Vectorrotation-vectorx:y:z-3D attitude control (quaternion)
Game Rotation Vectorgame-rotation-vectorx:y:z-Game control (no magnetometer)
Geomagnetic Rotation Vectorgeomagnetic_rotationx:y:z-Compass, navigation
Orientation Sensororientationazimuth:pitch:rolldegrees(Deprecated) Recommended to use rotation vector

2.2 Position & Environment Sensors

Sensor NameIdentifier (Key)Data FormatUnitUse Case
Magnetometermagnetic-fieldx:y:zμTCompass, metal detection
Uncalibrated Magnetometermagnetic-field-uncalibratedx:y:zμTRaw magnetic field data
Light SensorlightvalueluxAuto screen brightness
Proximity SensorproximitydistancecmCall screen-off
Temperature Sensortemperaturevalue℃Temperature monitoring (device dependent)
Pressure SensorpressurevaluehPaAltitude, weather
Humidity Sensorhumidityvalue%Environment monitoring (device dependent)

2.3 Motion Detection & Biometric Sensors

Sensor NameIdentifier (Key)Data FormatUnit/ValueUse Case
Step Counterstep-countercountstepsFitness & health
Step Detectorstep-detectorvalue1.0Real-time step detection
Significant Motionsignificant-motionvalue1.0Power-saving trigger
Generic Motionmotion-detectvalue1.0Security monitoring
Tilt Detectiontilt-detectorvalue1.0Wake-up, orientation lock
Pick-up Gesturepick-upvalue1.0Auto screen on
Heart Rateheart-ratebpmBPMHealth monitoring (device dependent)
Wrist Tiltwrist-tiltvalue:measurementId-Smart wearable gesture

2.4 Foldable Device Specific Sensors (Foldable)

Only effective when simulating foldable device models (e.g., Galaxy Fold, Mate X).

Sensor NameIdentifier (Key)Data FormatUnitDescription
Hinge Anglehinge-angle0 (to 2)angledegreesSimulate screen folding angle

3. Usage & Configuration Process

Sensor simulation is driven by setting a system property pointing to a local data file.

3.1 Core Commands

Bash

# Set sensor data file path
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/sensor_data.txt

# Stop simulation (clear property)
adb shell setprop persist.sys.cloud.sensor.tpl_dp ""

3.2 Data File Specification

  • File Encoding: UTF-8
  • Permissions: File must be readable (recommended chmod 644)
  • Size Limit: Maximum 1GB
  • Basic Structure: Sensor data lines + delay command lines (delay:milliseconds)

File Content Example:

Plaintext

# Simulate tilting left
acceleration:-5.62:2.94:7.21
gyroscope:-0.62:-0.12:0.12
delay:50

# Simulate tilting right
acceleration:5.62:2.94:7.21
gyroscope:0.62:0.12:-0.12
delay:50

4. Practical Scenarios: How to Simulate

Scenario 1: Simulate Device Rotation (Python Data Generation)

Used to test UI adaptation or game controls during device rotation.

  1. Generate Data: Use Python script to create 0–360° rotation data.

    Python

    import math
    
    with open('rotation.txt', 'w') as f:
        for angle in range(0, 361, 5):
            rad = math.radians(angle)
            # Simulate X/Z axis gravity component changes
            acc_x = 9.8 * math.sin(rad)
            acc_z = 9.8 * math.cos(rad)
            f.write(f"acceleration:{acc_x:.6f}:0.000000:{acc_z:.6f}\n")
            f.write("delay:100\n")
    
  2. Inject Data:

    Bash

    adb push rotation.txt /data/local/tmp/
    adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/rotation.txt
    
  3. Verify: Restart the target app and observe if the interface rotates with the data.

Scenario 2: Simulate “Shake” Gesture

Used to test features like WeChat Shake.

  1. Create Data File (shake.txt):

    Plaintext

    # Strong left shake
    acceleration:-19.0:0.0:5.0
    gyroscope:0.0:0.0:8.0
    delay:80
    # Strong right shake
    acceleration:19.0:0.0:5.0
    gyroscope:0.0:0.0:-8.0
    delay:80
    # Return to stationary
    acceleration:0.0:0.0:9.8
    gyroscope:0.0:0.0:0.0
    delay:200
    
  2. Execute Simulation:

    Bash

    adb push shake.txt /data/local/tmp/
    adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/shake.txt
    # Launch app for testing
    adb shell am start com.tencent.mm/.ui.LauncherUI
    

5. Best Practices & Notes

Data Optimization Suggestions

  • Smooth Transitions: Avoid sudden value jumps. Use interpolation algorithms to generate transition data between states (e.g., stationary → motion) to prevent app logic errors.
  • Reasonable Delays:
    • Games/VR: delay:16 (≈60Hz)
    • Navigation: delay:200 – 1000 (1–5Hz)
    • General apps: delay:50 – 100 (10–20Hz)
  • Physical Realism:
    • When stationary, accelerometer Z-axis should be approximately 9.8 m/s².
    • Magnetometer strength typically ranges between 25–65 μT.

Common Troubleshooting

SymptomPossible CauseSolution
App no responsePermission or no restart1. Ensure app has sensor permission. 2. force-stop and restart app to re-register SensorListener.
Simulation not workingWrong path or permission1. Verify setprop path. 2. Run adb shell chmod 644 <file_path>.
Specific sensor invalidDevice incompatibilityKey point: The cloud phone model must support that hardware. Sensors like humidity, heart-rate, or hinge-angle only work on specific model templates (e.g., high-end Samsung, foldables). Check cloud instance config.
Motion stutteringLow sampling rateDecrease delay value in the file.

Next Steps Suggestion

If you need to capture real complex motion data (e.g., running, driving), it is recommended to write a simple Android tool app, install it on a physical device, use SensorManager to listen to sensors, write the data in the above format to a text file, and then directly import it into the cloud phone. This will provide much more realistic data than script-generated values.

Prev
Xposed-like / LSPosed Framework