Page tree
Skip to end of metadata
Go to start of metadata

Offline Camera instrumentation is the process of adding SeeTest's 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

Mock source code

The jar of source code can be acquired by contacting Experitest support.


Instrumenting Camera 1 libraries:

To work with camera 1 SeeTest libraries, you need to change the following in your app's source code:

  • Add jar 'mock-camera1’ to your app build.gradle 
  • All occurrences of class “android.hardware.camera” should be replaced by “com.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 jar 'mock-camera2’ to your app build.gradle 

  • All occurrences of class  "android.hardware.camera2.CameraManager" should be replaced by "com.mock.CameraManager"
  • Occurrence of "getSystemService(Context.CAMERA_SERVICE)" should be replaced by "CameraManagerInstantiator.get(this)"
  • All occurrences of class  "android.view.TextureView" should be replaced by "com.mock.TextureView"
  • All occurrences of class  "android.media.ImageReader" should be replaced by "com.mock.ImageReader"
  • In res files - the occurrence of "TextureView" should be replaced by "com.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>
  • No labels