Device Lab Testing
ZKite includes a comprehensive, self-contained reference application: Device Lab. It exercises every device API—permissions, pickers, camera, microphone, audio playback, sensors, location, biometric authentication, and encrypted storage—without third-party dependencies.
Running Device Lab
Section titled “Running Device Lab”Device Lab is located in the official ZKite repository under examples/device_lab.
# Clone the repository (if not already local)git clone https://github.com/AbhinavKrShukla/zkite.gitcd zkite/examples/device_lab
# Connect your Android phone via USB and runzkite runzkite run scans the Python code, automatically infers required permissions in app.json, builds a development APK, verifies the manifest, installs it to your device over ADB, and launches the application.
Testing File Uploads Locally
Section titled “Testing File Uploads Locally”Device Lab contains a test button to stream a selected file over multipart HTTP. To test uploads without a remote cloud server:
-
Start a local HTTP echo server on your computer on port
8769:Terminal window python -m http.server 8769 -
Reverse the port over ADB so your connected Android phone routes requests to
localhost:8769directly to your computer:Terminal window adb reverse tcp:8769 tcp:8769 -
Tap Upload Test inside Device Lab. The upload streams over ADB with live progress updates.
Device Qualification Checklist
Section titled “Device Qualification Checklist”When developing or certifying an application using device APIs, test these real-world mobile edge cases:
- Permission Denial: Tap “Don’t allow” when prompted with microphone, camera, or location dialogs. Verify your UI displays a graceful message without crashing.
- Picker Cancellation: Launch the document or photo picker and immediately press the Android back button or gesture. Verify the operation returns
Nonecleanly. - Hardware Availability: Test on devices that lack specific sensors (such as an emulator without a magnetometer or gyro). Verify that
UnsupportedFeatureis handled gracefully. - Background & Resume: Begin an audio recording or sensor stream, then press the home button or lock the screen. Verify the sensor stream pauses cleanly and resumes upon return.
- Hot Reload Safety: Edit Python code while an async device operation is running. Verify that in-flight coroutines are invalidated without corrupting application state.
