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
this is my source code, its work on android <13 but can't in android 13
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { PERMISSIONS = new String[]{ Manifest.permission.READ_MEDIA_IMAGES, Manifest.permission.READ_MEDIA_VIDEO, Manifest.permission.READ_MEDIA_AUDIO }; } else { PERMISSIONS = new String[]{ Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE, Manifest.permission.CAMERA }; }
// Check and request permissions if needed checkAndRequestPermissions();
private void checkAndRequestPermissions() { boolean allPermissionsGranted = true;
// Check if all permissions are granted for (String permission : PERMISSIONS) { int permissionCheck = ContextCompat.checkSelfPermission(this, permission); if (permissionCheck != PackageManager.PERMISSION_GRANTED) { allPermissionsGranted = false; break; } } if (!allPermissionsGranted) { // Request permissions ActivityCompat.requestPermissions(this, PERMISSIONS, PERMISSION_REQUEST_CODE); } else { // All permissions are granted, proceed with your logic (e.g., captureImage()) captureImage(); } } private void captureImage() { Toast.makeText(this, "tuktutkkkk", Toast.LENGTH_SHORT).show(); ImagePicker.Companion.with(PatroliActivity.this) .crop() .cameraOnly() .compress(1024) .crop(3f, 2f) .start(20); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); if (requestCode == PERMISSION_REQUEST_CODE) { boolean allPermissionsGranted = true; // Check if all requested permissions are granted for (int grantResult : grantResults) { if (grantResult != PackageManager.PERMISSION_GRANTED) { allPermissionsGranted = false; break; } } if (allPermissionsGranted) { // All permissions are granted, proceed with your logic (e.g., captureImage()) captureImage(); } else { // Permissions not granted, handle accordingly (show a message, disable functionality, etc.) // You can show a message or take appropriate action here } } }
The text was updated successfully, but these errors were encountered:
I had the same issue and I solved it by upgrading the library version to 2.1
Sorry, something went wrong.
No branches or pull requests
this is my source code, its work on android <13
but can't in android 13
// Check and request permissions if needed
checkAndRequestPermissions();
private void checkAndRequestPermissions() {
boolean allPermissionsGranted = true;
The text was updated successfully, but these errors were encountered: