Skip to main content
Use device.setVirtualSceneImage() and device.playAutomation() to place a barcode or QR code image in the emulator’s virtual camera scene and animate the camera toward it — simulating a real scan without a physical device. See the Android Device Reference for the full API. The sequence is: store the barcode image in team storage → place it on the virtual scene (table or wall) → play the Walk_to_image_room macro to animate the camera toward it → wait for your app to detect and process the scan.
Store your barcode image in team storage and reference it via process.env.TEAM_STORAGE_DIR. See Upload files for instructions. The image must encode the exact value your test expects.

Examples

Scan a barcode on the virtual table
Scan a barcode on the virtual wall

When to use

  • Your app has a barcode or QR code scanner and you need to test it without physical hardware.
  • Your app uses QR codes to initiate a session, link an account, or navigate to a URL.
  • Your app reads barcodes as part of a checkout, inventory, or verification flow.
  • Your test needs to assert on a specific scanned value.

Full sample test

Last modified on May 20, 2026