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-camera1to your app'sbuild.gradle. -
Replace all occurrences of
android.hardware.camerawithcom.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-camera2to 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.TextureViewwithcom.mock.TextureView - Class
android.media.ImageReaderwithcom.mock.ImageReader
- Class
-
In the res files, replace occurrences of
TextureViewwithcom.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>