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

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 the adequate app permissions to the AndroidManifest.xml.

Once you have specified them in your AndroidManifest.xml, you can enable them via adb, for example:

adb shell pm grant com.test.appname android.permission.READ_MEDIA_IMAGES
adb shell pm grant com.test.appname android.permission.READ_MEDIA_VIDEO

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