Running Affectiva SDK example in Android Studio Emulator


When i am running the provided example project in the Android Emulator, the App crashes - even when i set the Advanced Settings Configuration the Front Camera to “Webcam0”.

The log show that the app crashes when initializing the CameraDetector.

detector = new CameraDetector(this, CameraDetector.CameraType.CAMERA_FRONT, cameraPreview);
  1. How can i catch this exception if there is no front camera detected, since the whole code is based on the detector?

  2. How can i run the example in the emulator using the webcam?

I was thinking of a simple check for the front cameras existence like this:

public static boolean frontCameraIsAvailable(Context context) {
    return context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_FRONT);

Thanks for your help!