im just wondering. Wasnt it declared by devs that to open media files in shared storage, who comes from another app, need to declare permission in Manifest?
Like why is this code working without any permissions? I can open nearly every picture in shared storage i have on my phone and use it inside my owner app.
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
intent.addCategory(Intent.CATEGORY_OPENABLE);
intent.setType("image/*");
activityResultLauncher.launch(intent);
}
});
}
ActivityResultLauncher<Intent> activityResultLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), new ActivityResultCallback<ActivityResult>() {
@Override
public void onActivityResult(ActivityResult result) {
Uri uri = result.getData().getData();
imageView.setImageURI(uri);
}
});