I am trying to develop a face tracking app using the Google Vision API (API doc)
This is my manifest:
<uses-permission android:name="android.permission.CAMERA"/>
<uses-feature android:name="android.hardware.camera.front" android:required="true"/>
<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="face"></meta-data>
*activities*
This is my code:
private void startCameraSource() {
try {
mCameraSource.start(mPreviewHolder);
} catch (IOException e) {
//Error handling
Toast.makeText(this, "Could not start camera!", Toast.LENGTH_LONG).show();
}
}
This is the error in Logcat:
Caused by: java.lang.RuntimeException: Fail to connect to camera service
E/AndroidRuntime: at android.hardware.Camera.<init>(Camera.java:520)
E/AndroidRuntime: at android.hardware.Camera.open(Camera.java:361)
E/AndroidRuntime: at com.google.android.gms.vision.CameraSource.zzEu(Unknown Source)
E/AndroidRuntime: at com.google.android.gms.vision.CameraSource.start(Unknown Source)
Why does this happen (...on an Xperia Z3 compact 5.1)?
UPDATE:
I spotted a new error. I think it might be the reason why my code is not working.
How can I resolve this problem?
W/ServiceManager: Permission failure: android.permission.CAMERA from uid=10241 pid=26845
E/CameraService: Permission Denial: can't use the camera pid=26845, uid=10241