I'm trying to run Google Vision FaceTracker but I have an error on one line of code in CameraSourcePreview
.
This is the error -
Call requires permission which may be rejected by user: code should explicitly check to see if permission is available (with checkPermission
) or explicitly handle a potential SecurityException
And this is the function-
private void startIfReady() throws IOException {
if (mStartRequested && mSurfaceAvailable) {
mCameraSource.start(mSurfaceView.getHolder()); //Error
//...other code
mStartRequested = false;
}
}
It does seem that you are not getting the correct permissions that FaceTracker needs. For your needs just add the facetracker permissions into the below implementation and interface.
In our app we added an interface with a callback which handles all our permissions for us :
The implementation is pretty simple :