W
W
wjdbx03shxxhs2021-11-05 19:02:11
Android
wjdbx03shxxhs, 2021-11-05 19:02:11

Android storage access?

Hello, tell me, I downloaded the application from the play market. The application has the ability to download files without providing access to the drive. After clicking "upload file" no permissions are required, it immediately goes to the file manager and offers to select a file. What does it mean?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikolay Savelyev, 2021-11-05
@wjdbx03shxxhs

this is Content Provider

O
Oleg, 2021-11-05
@402d

private final ActivityResultLauncher<String> mGetContent = registerForActivityResult(new ActivityResultContracts.GetContent(), this::fileSelected);

mGetContent.launch("*/*");

It is done in 2 lines of code, it remains only in fileSelected() to write what to do with the received data.
It is considered safe, since the user himself in another application explicitly indicates what can be given to the application.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question