I work on improvement functionality for android app. There is a feature for making photo from app. And for andorid 11<=
takePictureIntent.resolveActivity(getPackageManager())
returns null. I know it's because of higher android version. But when I removed if statement everything working so I wonder why this line was there and what wrong could happened if it will be removed.
private void dispatchTakePictureIntent() {
Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
if (takePictureIntent.resolveActivity(getPackageManager()) != null) {
//if (true) {
File photoFile = createImageFile();
if (photoFile != null) {
takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);
}
}
}