We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miss Permission
The text was updated successfully, but these errors were encountered:
This code editing should fix
`
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main_activity); if (!checkPermissionFromDevice()) requestPermission(); mPreview = findViewById(R.id.surface_view); captureButton = findViewById(R.id.button_capture); } private boolean checkPermissionFromDevice() { int write_external_storage_result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE); int camera_result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA); int record_audio_result = ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO); return write_external_storage_result == PackageManager.PERMISSION_GRANTED && camera_result == PackageManager.PERMISSION_GRANTED && record_audio_result == PackageManager.PERMISSION_GRANTED; } private void requestPermission() { ActivityCompat.requestPermissions( this, new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, REQUEST_PERMISSION_CODE); }
Sorry, something went wrong.
No branches or pull requests
Miss Permission
The text was updated successfully, but these errors were encountered: