I'm accessing the camera through Cordova plugin (android). For this, I'm asking permission to the user. If the user clicks "allow" in permission dialog I have to start the camera. For this, in native android, I'm overriding onRequestPermissionsResult method like
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
switch (requestCode) {
case RequestCameraPermissionID: {
if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
return;
}
try {
cameraSource.start(surfaceView.getHolder());
} catch (IOException e) {
e.printStackTrace();
}
}
}
break;
}
}
So, i want to use onRequestPermissionsResult in Cordova plugin. Can any one help me in this?