QSL4A (Scripting Layer for Android) API Documentation¶
QSL4A is QPython's scripting layer for Android, allowing you to control Android device features using Python.
Quick Start¶
import androidhelper
droid = androidhelper.Android()
# Show a toast message
droid.makeToast('Hello QPython!')
# Vibrate the device
droid.vibrate(500)
# Get battery level (start monitoring first)
import time
droid.batteryStartMonitoring()
time.sleep(0.5) # Wait for data
battery = droid.readBatteryData().result
print(f"Battery: {battery['level']}%")
Documentation Structure¶
Core Modules¶
- Android Base - Core connection and RPC
- Intent System - Android Intent operations
- Event System - Event handling and broadcasting
UI Components¶
- Dialogs - Alert, input, choice dialogs
- FullScreen UI - Custom layout UI
- FloatView - Floating window
- Accessibility - Screen automation
System¶
- Battery - Battery monitoring
- Sensors - Device sensors
- Application - App management
- System Info - Device information
Hardware¶
- Bluetooth - Bluetooth operations
- Camera - Photo and video capture
- Audio/Recorder - Audio recording
Connectivity¶
Storage¶
- DocumentFile - File operations
- Clipboard - Clipboard operations
Media¶
- Media Player - Audio/Video playback
- Image Processing - Image operations
Special Features¶
Result Object¶
Most QSL4A methods return a Result namedtuple with:
- id - Request ID
- result - The actual result data
- error - Error message if failed