Skip to main content

Testing real-time scanning with a mock camera

Overview

The SDK's mock camera feature lets developers emulate a real camera's behavior using an image file in place of a live camera stream. You can set the path to the image file within the app folder or another specified directory.

Initialization

To initialize the mock camera, run the following code before initializing the RTU UI screen or before injecting the camera into the UI.

caution

The mock camera feature is only intended for testing purposes. Please do not use it in production.

Mock Camera
loading...

Permissions

Android

caution

On Android, the mock camera currently requires a one-time manual approval for accessing files. This might change in the future.

The mock camera feature currently does not need permission if you are using internal files. For working with files outside the app directory (e.g., for accessing files from common locations like the Downloads folder, which is useful for testing with a variety of preloaded images) you need to add app permissions to the AndroidManifest.xml. For Android < 33 use android.permission.READ_EXTERNAL_STORAGE permission and for Android >= 33 use android.permission.READ_MEDIA_IMAGES and android.permission.READ_MEDIA_VIDEO. You can also enable this permission via adb:

adb shell pm grant com.test.appname android.permission.READ_EXTERNAL_STORAGE
adb shell appops set com.test.appname MANAGE_EXTERNAL_STORAGE allow

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get free trial license