-
-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
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
Creating app's custom folder in internal storage root path without any permissions #108
Comments
I understand that you want to create a folder without prompt any dialogs to the user, i.e. Even WhatsApp is no longer able to create custom directory like
Those paths do not require any storage permissions.
You're trying to create an enum from string |
Can you give me an example? How should I go about implementing it? |
Here's the example: val input = URL("https://google.com/audio.mp3").openStream()
val folder = externalMediaDirs.first()
val file = File(folder, "recitation.mp3")
val output = file.outputStream()
// will be located in /storage/emulated/0/Android/media/<app-package>/recitation.mp3
output.write(input.read()) |
Library version: 1.5.3
OS version: Android 11
Device model: Infinix X693
Describe the bug
So basically my main objective is to gain access to the Internal Directory "storage/emulated/0" and create a new directory with my Android App's name. The app will be storing some audio files there. I have attached the code (Github Gist) that I used. I made use of
SimpleStorageHelper
that helps me get the access to a specific folder in the internal storage. But I want access to the whole root so that I can make my directory there. Focus on thecreateAudioFolder()
function at line 42 where I usePublicDirectory()
to getDocumentFile
parent. I am also trying to get absolute path to the folder which I will later use forMediaRecorder
. I have to pass a path to thesetOutputFile()
as an argument which will create an audio file at line 116.In the video, you can see
storageHelper.requestStorageAccess()
is called , it asks for access to the files but then it crashes and it reverts back to the original Login Activity.https://user-images.githubusercontent.com/67544354/210143938-f11fb483-8b97-489e-ac96-876c04708ff3.mp4
https://gist.github.com/maq796113/a1757542fb5891def3d4285cdb044a6c
Stacktrace
The text was updated successfully, but these errors were encountered: