Offline Camera Instrumentation
Please note that this tool is classified as a Legacy tool. We recommend transitioning to our updated solutions to maintain optimal performance and security in your workflows. For more information on this matter, please reach out to technical support .
Offline Camera Instrumentation is the process of adding camera mocking capabilities to the app in the app build process, as opposed to adding those libraries in the import process.
This feature is not supported for apps which delegate camera actions to third party libraries.
To obtain the source code JAR, contact technical support.
Instrumenting Camera 1 Libraries
To work with the camera 1 Continuous Testing libraries, make these changes to the source code.
-
Add the Jar
mock-camera1
to your app'sbuild.gradle
. -
Replace all occurrences of
android.hardware.camera
withcom.mock.Camera
. -
Add the following tag to manifest.
<receiver android:name="com.mock.ImR" android:enabled="true" android:exported="true" >
<intent-filter>
<action android:name= "<your app package id>.mcip.ir"/>
</intent-filter>
</receiver>
Instrumenting Camera 2 Libraries
-
Add the JAR
mock-camera2
to your app'sbuild.gradle
. -
Replace all these:
- Class
android.hardware.camera2.CameraManage
" withcom.mock.CameraManager
. getSystemService(Context.*CAMERA_SERVICE*)
withCameraManagerInstantiator.*get*(this)
- Class
android.view.TextureView
withcom.mock.TextureView
- Class
android.media.ImageReader
withcom.mock.ImageReader
- Class
-
In the res files, replace occurrences of
TextureView
withcom.mock.TextureView
. -
Add the following tag to manifest:
<receiver android:name="com.mock.CameraReceiver" android:enabled="true" android:exported="true" >
<intent-filter>
<action android:name= "<your app package id>.mcip2.ir"/>
</intent-filter>
</receiver>