Introduction
ARMCLOUD cloud phone supports dynamic data simulation for various mobile device sensors, including gravity sensors, gyroscopes, magnetometers, accelerometers, and more. By simulating realistic sensor data, it provides authentic device state simulation for various application scenarios.
Supported Sensor Types
1. Motion Sensors
Accelerometer (acceleration)
- Format:
acceleration:x:y:z - Function: Simulates device acceleration changes on X, Y, Z axes
- Unit: m/s²
- Use Cases: Gravity-sensing games, pedometer apps, screen rotation control
Linear Accelerometer (linear-acceleration)
- Format:
linear-acceleration:x:y:z - Function: Simulates linear acceleration excluding gravity
- Unit: m/s²
- Use Cases: Precise motion detection, gesture recognition
Uncalibrated Accelerometer (acceleration-uncalibrated)
- Format:
acceleration-uncalibrated:x:y:z - Function: Raw acceleration data including bias
- Unit: m/s²
Gyroscope (gyroscope)
- Format:
gyroscope:x:y:z - Function: Simulates device angular velocity changes around three axes
- Unit: rad/s
- Use Cases: Motion-sensing games, VR/AR applications, camera stabilization
Uncalibrated Gyroscope (gyroscope-uncalibrated)
- Format:
gyroscope-uncalibrated:x:y:z - Function: Raw gyroscope data including bias
- Unit: rad/s
Gravity Sensor (gravity)
- Format:
gravity:x:y:z - Function: Simulates gravity components in device coordinate system
- Unit: m/s²
- Use Cases: Level apps, attitude detection
2. Position Sensors
Magnetometer (magnetic-field)
- Format:
magnetic-field:x:y:z - Function: Simulates device magnetic field strength and direction detection
- Unit: μT (microtesla)
- Use Cases: Compass apps, navigation software, metal detectors
Uncalibrated Magnetometer (magnetic-field-uncalibrated)
- Format:
magnetic-field-uncalibrated:x:y:z - Function: Raw magnetic field data including bias
- Unit: μT
Orientation Sensor (orientation)
- Format:
orientation:azimuth:pitch:roll - Function: Simulates device Euler angle attitude
- Unit: degrees (deprecated, recommend using rotation vector)
3. Rotation Sensors
Rotation Vector (rotation-vector)
- Format:
rotation-vector:x:y:z - Function: Simulates device rotation state (first three components of quaternion)
- Use Cases: 3D applications, VR/AR, attitude control
Game Rotation Vector (game-rotation-vector)
- Format:
game-rotation-vector:x:y:z - Function: Rotation vector without magnetometer
- Use Cases: Game control, magnetic interference-free scenarios
Geomagnetic Rotation Vector (geomagnetic_roation)
- Format:
geomagnetic_roation:x:y:z - Function: Rotation vector based on accelerometer and magnetometer
- Use Cases: Compass, navigation apps
4. Environmental Sensors
Light Sensor (light)
- Format:
light:value - Function: Simulates ambient light intensity
- Unit: lux
- Use Cases: Automatic screen brightness adjustment, photography scene detection
Proximity Sensor (proximity)
- Format:
proximity:distance - Function: Simulates distance between object and device
- Unit: cm
- Use Cases: Screen off during calls, gesture control
Temperature Sensor (temperature)
- Format:
temperature:value - Function: Simulates ambient temperature
- Unit: ℃
- Use Cases: Weather apps, temperature monitoring
Pressure Sensor (pressure)
- Format:
pressure:value - Function: Simulates atmospheric pressure
- Unit: hPa (hectopascal)
- Use Cases: Altitude measurement, weather prediction
Humidity Sensor (humidity)
- Format:
humidity:value - Function: Simulates relative humidity
- Unit: % (relative humidity percentage)
- Use Cases: Weather apps, indoor environment monitoring
5. Motion Detection Sensors
Step Counter (step-counter)
- Format:
step-counter:count - Function: Cumulative step count statistics
- Unit: steps (integer)
- Use Cases: Health apps, activity tracking
Step Detector (step-detector)
- Format:
step-detector:value - Function: Detects occurrence of each step
- Use Cases: Real-time step detection, motion analysis
Significant Motion (significant-motion)
- Format:
significant-motion:value - Function: Detects significant device movement
- Use Cases: Power saving mode, location update triggering
Motion Detection (motion-detect)
- Format:
motion-detect:value - Function: General motion detection
- Use Cases: Security monitoring, energy saving control
Tilt Detector (tilt-detector)
- Format:
tilt-detector:value - Function: Detects device tilt state changes
- Use Cases: Screen orientation lock, tilt control
Pick-up Gesture (pick-up)
- Format:
pick-up:value - Function: Detects device pick-up action
- Use Cases: Auto screen wake, gesture activation
6. Biometric Sensors
Heart Rate Sensor (heart-rate)
- Format:
heart-rate:bpm - Function: Simulates heart rate data
- Unit: BPM (beats per minute)
- Use Cases: Health monitoring, fitness tracking
7. Foldable Device Sensors
Hinge Angle Sensor (hinge-angle0/1/2)
- Format:
hinge-angle0:angle,hinge-angle1:angle,hinge-angle2:angle - Function: Simulates foldable device folding angle
- Unit: degrees
- Use Cases: Foldable screen device adaptation, multi-screen display control
8. Wearable Device Sensors
Wrist Tilt Gesture (wrist-tilt)
- Format:
wrist-tilt:value:measurementId - Function: Detects wrist lift action
- Use Cases: Smartwatch screen wake, gesture recognition
Usage Methods
System Property Configuration (Recommended)
1. Set System Property
Set system property to specify sensor data file path:
setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/sensor1.txt
2. Create Sensor Data File
Create sensor data file at specified path with the following format:
# /data/local/tmp/sensor1.txt
acceleration:-0.62871414:2.946163:9.217153
gyroscope:-3.625:-0.8125:1.2125
magnetic-field:1.4375:24.475:-18.362501
delay:50
acceleration:-0.52871414:2.846163:9.317153
gyroscope:-3.525:-0.7125:1.3125
magnetic-field:1.5375:24.575:-18.262501
delay:50
3. Data File Format Description
Three-axis Sensors (x:y:z format)
| Sensor Type | Format Example | Unit | Description |
|---|---|---|---|
acceleration | acceleration:-0.628:2.946:9.217 | m/s² | Accelerometer data |
linear-acceleration | linear-acceleration:0.1:-0.2:0.05 | m/s² | Linear acceleration |
acceleration-uncalibrated | acceleration-uncalibrated:-0.63:2.95:9.22 | m/s² | Uncalibrated acceleration |
gyroscope | gyroscope:-3.625:-0.8125:1.2125 | rad/s | Gyroscope data |
gyroscope-uncalibrated | gyroscope-uncalibrated:-3.62:-0.81:1.21 | rad/s | Uncalibrated gyroscope |
gravity | gravity:0.0:0.0:9.8 | m/s² | Gravity sensor |
magnetic-field | magnetic-field:1.4375:24.475:-18.3625 | μT | Magnetometer data |
magnetic-field-uncalibrated | magnetic-field-uncalibrated:1.44:24.48:-18.36 | μT | Uncalibrated magnetometer |
orientation | orientation:45.0:10.5:-5.2 | degrees | Orientation sensor (deprecated) |
rotation-vector | rotation-vector:0.1:0.2:0.3 | - | Rotation vector |
game-rotation-vector | game-rotation-vector:0.15:0.25:0.35 | - | Game rotation vector |
geomagnetic_roation | geomagnetic_roation:0.12:0.22:0.32 | - | Geomagnetic rotation vector |
Single-value Sensors (value format)
| Sensor Type | Format Example | Unit | Description |
|---|---|---|---|
light | light:500.0 | lux | Light intensity |
proximity | proximity:0.0 | cm | Distance sensor |
temperature | temperature:25.5 | ℃ | Ambient temperature |
pressure | pressure:1013.25 | hPa | Atmospheric pressure |
humidity | humidity:65.0 | % | Relative humidity |
step-counter | step-counter:1250 | steps | Cumulative steps |
step-detector | step-detector:1.0 | - | Step detection |
significant-motion | significant-motion:1.0 | - | Significant motion |
motion-detect | motion-detect:1.0 | - | Motion detection |
tilt-detector | tilt-detector:1.0 | - | Tilt detection |
pick-up | pick-up:1.0 | - | Pick-up gesture |
heart-rate | heart-rate:72.0 | BPM | Heart rate |
hinge-angle0 | hinge-angle0:90.0 | degrees | Hinge angle 0 |
hinge-angle1 | hinge-angle1:45.0 | degrees | Hinge angle 1 |
hinge-angle2 | hinge-angle2:0.0 | degrees | Hinge angle 2 |
Special Format Sensors
| Sensor Type | Format Example | Description |
|---|---|---|
wrist-tilt | wrist-tilt:1.0:12345 | Wrist tilt:value:measurement ID |
delay | delay:50 | Delay interval in milliseconds |
4. File Limitations
- Maximum file size: 1GB
- Supported format: Plain text files
- Encoding requirement: UTF-8
- Permission requirement: File must have read permissions
Data Collection and Generation
1. Real Device Data Collection
You can collect sensor data from real devices to generate simulation files:
Android Data Collection Example
public class SensorDataCollector implements SensorEventListener {
private SensorManager sensorManager;
private FileWriter fileWriter;
public void startCollection() {
try {
fileWriter = new FileWriter("/sdcard/sensor_data.txt");
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
// Register sensor listeners
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
SensorManager.SENSOR_DELAY_GAME);
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE),
SensorManager.SENSOR_DELAY_GAME);
sensorManager.registerListener(this,
sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD),
SensorManager.SENSOR_DELAY_GAME);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onSensorChanged(SensorEvent event) {
try {
String line = "";
switch (event.sensor.getType()) {
case Sensor.TYPE_ACCELEROMETER:
line = String.format("acceleration:%.8f:%.8f:%.8f\n",
event.values[0], event.values[1], event.values[2]);
break;
case Sensor.TYPE_GYROSCOPE:
line = String.format("gyroscope:%.8f:%.8f:%.8f\n",
event.values[0], event.values[1], event.values[2]);
break;
case Sensor.TYPE_MAGNETIC_FIELD:
line = String.format("magnetic-field:%.8f:%.8f:%.8f\n",
event.values[0], event.values[1], event.values[2]);
break;
}
fileWriter.write(line);
fileWriter.write("delay:50\n");
fileWriter.flush();
} catch (IOException e) {
e.printStackTrace();
}
}
}
2. Data File Generation Script
Python Script Example
#!/usr/bin/env python3
import math
import time
def generate_rotation_data(output_file):
"""Generate sensor data for device rotation"""
with open(output_file, 'w') as f:
for angle in range(0, 361, 5): # 0 to 360 degrees, one data point every 5 degrees
rad = math.radians(angle)
# Simulate gravity decomposition at different angles
acc_x = 9.8 * math.sin(rad)
acc_y = 0
acc_z = 9.8 * math.cos(rad)
# Simulate angular velocity during rotation
gyro_x = 0.1 if angle < 180 else -0.1
gyro_y = 0
gyro_z = 0
# Magnetometer data remains relatively stable
mag_x = 25.0 * math.cos(rad)
mag_y = 25.0 * math.sin(rad)
mag_z = -18.0
f.write(f"acceleration:{acc_x:.6f}:{acc_y:.6f}:{acc_z:.6f}\n")
f.write(f"gyroscope:{gyro_x:.6f}:{gyro_y:.6f}:{gyro_z:.6f}\n")
f.write(f"magnetic-field:{mag_x:.6f}:{mag_y:.6f}:{mag_z:.6f}\n")
f.write("delay:100\n")
def generate_shake_data(output_file):
"""Generate sensor data for shake gesture"""
with open(output_file, 'w') as f:
for shake in range(10): # 10 shake motions
# Shake left
f.write("acceleration:-15.0:0.0:9.8\n")
f.write("gyroscope:0.0:0.0:5.0\n")
f.write("magnetic-field:1.4375:24.475:-18.362501\n")
f.write("delay:100\n")
# Shake right
f.write("acceleration:15.0:0.0:9.8\n")
f.write("gyroscope:0.0:0.0:-5.0\n")
f.write("magnetic-field:1.4375:24.475:-18.362501\n")
f.write("delay:100\n")
# Return to rest
f.write("acceleration:0.0:0.0:9.8\n")
f.write("gyroscope:0.0:0.0:0.0\n")
f.write("magnetic-field:1.4375:24.475:-18.362501\n")
f.write("delay:200\n")
# Usage example
generate_rotation_data("/data/local/tmp/rotation.txt")
generate_shake_data("/data/local/tmp/shake.txt")
Dynamic Simulation Scenarios
1. Device Rotation Simulation
Using Data File Method
# 1. Generate rotation data file
python3 generate_rotation.py
# 2. Upload to cloud phone
adb push rotation.txt /data/local/tmp/
# 3. Set system property to enable simulation
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/rotation.txt
# 4. Restart target app to see effects
adb shell am force-stop com.example.app
adb shell am start com.example.app/.MainActivity
2. Shake Gesture Simulation
# Use pre-generated shake data file
adb push shake.txt /data/local/tmp/
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/shake.txt
# Start WeChat or other apps that support shake gesture for testing
adb shell am start com.tencent.mm/.ui.LauncherUI
Practical Operation Workflow
1. Complete Operation Example
# Connect to cloud phone
adb connect your-cloud-phone-ip:5555
# Upload prepared sensor data file
adb push sensor_walking.txt /data/local/tmp/
# Set file read permissions
adb shell chmod 644 /data/local/tmp/sensor_walking.txt
# Set system property
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/sensor_walking.txt
# Verify property setting
adb shell getprop persist.sys.cloud.sensor.tpl_dp
# Restart target app to make sensor data effective
adb shell am force-stop com.example.walkingapp
adb shell am start com.example.walkingapp/.MainActivity
# Check app logs to verify effects
adb logcat | grep SensorManager
2. Switching Between Different Scenario Data
# Switch to shake data
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/shake.txt
# Switch to rotation data
adb shell setprop persist.sys.cloud.sensor.tpl_dp /data/local/tmp/rotation.txt
# Disable sensor simulation (clear property)
adb shell setprop persist.sys.cloud.sensor.tpl_dp ""
Best Practices
1. Data File Management
- Naming Convention: Use meaningful file names like
walking_5min.txt,car_driving.txt - Data Integrity: Ensure each sensor data group has corresponding delay values
- File Size: Reasonably control file size to avoid approaching 1GB limit affecting performance
2. Data Reasonableness
- Accelerometer: In stationary state, Z-axis should be approximately 9.8m/s² (gravitational acceleration)
- Gyroscope: In stationary state, all three axes should be close to 0
- Magnetometer: Typical Earth magnetic field strength is approximately 25-65μT
3. Update Frequency Optimization
- Gaming apps: Recommend delay:16 (60Hz)
- Navigation apps: Recommend delay:200-1000 (1-5Hz)
- General apps: Recommend delay:50-100 (10-20Hz)
4. Data Smoothness
When generating data files, ensure smooth transitions between values:
# Smooth transition example
def smooth_transition(start_value, end_value, steps):
"""Smooth interpolation between two values"""
return [start_value + (end_value - start_value) * i / steps
for i in range(steps + 1)]
# Apply to sensor data generation
for i, acc_x in enumerate(smooth_transition(0, 9.8, 20)):
with open('smooth_data.txt', 'a') as f:
f.write(f"acceleration:{acc_x:.6f}:0.0:9.8\n")
f.write("delay:50\n")
Application Cases
1. Game Testing
- Simulate different device orientations to test gravity-sensing games
- Batch test device rotation effects on game interface
2. Navigation App Testing
- Simulate complex driving routes to test navigation accuracy
- Test map display effects at different positions
3. Health App Testing
- Simulate walking, running and other motion states
- Test pedometer and activity tracking functions
Important Notes
Performance Impact: Frequent sensor data updates may affect system performance, please adjust update frequency according to actual needs
App Permissions: Ensure target app has obtained corresponding sensor usage permissions
Data Consistency: Data from different sensors should maintain physical consistency, avoid conflicting data combinations
App Compatibility: Some older apps may have limited support for certain sensor data
Device Model Compatibility: Cloud phone sensor support depends on the simulated real device model. Some sensors are only available on specific models:
humidity(Humidity Sensor) - Not supported by most mid-to-low end modelstemperature(Temperature Sensor) - Only supported by some high-end modelsheart-rate(Heart Rate Sensor) - Mainly available on Samsung Galaxy series and other specific modelstilt-detector(Tilt Detector) - Some device gyroscope implementations may not support thismotion-detect(Motion Detection) - Depends on device's motion coprocessorhinge-angle0/1/2/3(Hinge Angle Sensors) - Only supported by foldable devices like Samsung Galaxy Fold, Huawei Mate X, etc.
Recommendation: Choose appropriate device model templates, or verify whether the current cloud phone instance's simulated model supports the target sensors before use
Troubleshooting
Common Issues
Q: App doesn't respond after setting sensor data
A: Check if the app has sensor permissions, or try restarting the app to reinitialize sensor listening
Q: Data updates are not smooth, showing jumps
A: Appropriately reduce update frequency, or add interpolation transitions between data points
Q: Sensor simulation doesn't work after setting system property
A: Check if system property path is correct, confirm data file exists and has read permissions (chmod 644), verify file format is correct, try restarting target app
Q: Some sensor data settings don't make app respond
A: This may be because the current cloud phone instance's simulated model doesn't support that sensor type. Particularly humidity, temperature, heart rate, hinge angle sensors only exist on specific real device models. Cloud phones determine sensor support based on the simulated model. Recommend testing with basic sensors (accelerometer, gyroscope, magnetometer) first, or choose device model templates that support target sensors