palash k answer is correct and worked for internal storage files, but in my case I want to open files from external storage also, my app crashed when open file from external storage like sdcard and usb, but I manage to solve the issue by modifying provider_paths.xml from the accepted answer
file storage emulated 0 download page.html
The bottom line is you can't share anything from the app's scoped storage. Also in Android 12, the intent chooser bottom dialog shows the preview of the image you are sharing which is super cool by the way, but it can't load the preview from the scoped storage URI.
I created a little web app to help at work. Just some HTML and JavaScript, and before Android started enforcing the Scoped Storage, I had no issues using it. Now when I try to load the URL (ie: file:///storage/emulated/0/__MyDocs/SignInTracker.html) I get an access denied error.
Browsing local files (in internal storage space) in Chrome using file:///sdcard/ or file://localhost/sdcard/, one can notice that only media files and subdirectories (if any) are listed in almost every folder except the "Download" folder (but not in its subfolders=subdirs).
This means that on Android 11, the folder from which Chrome can read local (m)HTML is /Download folder, not Android/data/
com.android.chrome/files/Download in internal or external storage space like in Android 10.
NOTE: on my Samsung devices, downloads onto internal storage were saved into /Download folder in all versions of Android (9, 10, 11), but downloads on an external SD card changed their folder from /storage/emulated/exSD_CARD/Android/data/
com.android.chrome/files/Download in Android 10 to /storage/emulated/exSD_CARD/Download in Android 11, where exSD_CARD is the device's label for external SD card (0123-4567 or 9C33-6BBD in my devices)
I need to use Total Commander's "Open with" functionality with file://url option checked, then choose Chrome in order to open (mhtml) file with Chrome (with file://url checked, the Chrome is in the list to choose from, with file://url option unchecked, it is not listed in the list) or to browse local files in internal storage directly in Chrome (file manager My Files provided with the device was unusable to choose mhtml files to be opened with Chrome)
Opening mhtml files from any folder using Total Commander, but with file://url option unchecked (in this case, the Chrome is not in 1st list, so you need to choose "Open with *" option with folder icon from the list and subsequently choose Chrome from next list) behaves differently. Opening in such a way leads not to successful opening or Access Denied message but to Save as Dialog Form in which one can choose also if the resaved mhtml file should be saved to internal storage or external SD card (if present). In this way, resaved mhtml files in /Download folder (on internal or external storage space) can be now opened using Total Commander "Open with" dialog with checked file://url option.
But nothing worked....the file names are always appended to the ASD. For instance, if the file name is
/storage/emulated/0/Download/test.txt
it will try to save on
/storage/emulated/0/Android/data/appname//storage/emulated/0/Download/test.txt
I recently lost the contents of a micro-SD card and hadn't backed up the contents recently enough. Luckily, I noticed that the pictures I was missing happen to be in /storage/emulated/0/DCIM/.thumbnails on my Android 5.1 device. The sad thing is I cannot get to those files to do anything with them on my device. The only way I even knew that they were there is because ASTRO File Manager brought them up when I searched for pictures. I would love to be able to put these in a safe place and hoped to be able to do so via my computer. Does anyone know of a way to get my computer (Windows 7) to recognize this file? (Naturally, I told my computer to view hidden files, so that's not the issue.) All I can see is /Internal storage and /SD card (not /storage). If you have a workaround, please let me know too. If I can move (or better yet copy) these photos to another place on my phone and then move them, that would be absolutely wonderful.
The "/storage/emulated/" folder does not really exist. It's what might be called a "symbolic link", or, in simpler terms, a reference to where the real data is stored. You'll need to find the actual physical location on your device where it is stored. Since it's in /storage/emulated/0/DCIM/.thumbnails, it's probably located in /Internal Storage/DCIM/.thumbnails/. Please note that that this folder probably only contains "thumbnails", which are very small versions of the real files. It's possible your real files are gone forever if your SD card is irrecoverable.
Edit:"Never Say Never"The link actually refers to an emulated SD Card on your device.Access the data "directly"* as the SD Card, and you will have access to all the data on that card.*Airdroid's file "app" will allow this. And, if memory serves, access via a USB data cable will also.
I 'm trying to run the Dynamic Table Layout and Table Listpicker example.
On my device it runs just fine.
But on the emulator (I want to see if the emulator is more convenient than my phone) I get an error: The web page at file://storage/emulated/0/AppInventor/assets/table.html could not be loaded as: the requested file was not found
I have got to know that with Android 11 their is Scoped Storage compulsory to be used. But then I want to know how can we create files out of app specific folder (Internal shared storage\Android\data).
I was facing the same issue when using GetExternalStoragePublicDirectory and creating files under /Storage/emulated/0/Documents.
Folder creation is successful, but when creating a new file, getting IOException saying that could not create file and File already exists.
I have Brave on my Moto G configured to download to my SD card, which in Brave is correctly displayed as /storage/5C12-9CBA/Android/data/com.brave.browser/files/Download. However when I download a page it is stored to internal memory instead, at /store/emulated/0/Android/data/com.brave.browser/files/Download
Another option here is to explore using the Azure Storage Emulator. This runs on your local machine (download it from here: -us/downloads/ - the download link is about half way down under "Command-line tools" -> "Azure Storage Emulator") and allows you to have something to talk to locally that quacks like Azure storage. Great for use in testing (automated, or otherwise) when you want to keep control over costs. Also great if you're sat on an airplane and want to work on your code - this is a "sore point" that going fully into using Azure resources to build solutions, rather than using Azure VMs can bring.
Once you've run it up, you'll see a command window that looks very much like the one in the image right at the top of this post. Some bits will look a little different, like the name of the SQL instance being used for storage and the name of the user (you!) that's been granted access to the instance. You don't actually have to keep this window open as the command that gets run by that shortcut is actually a .cmd file, C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\StartStorageEmulator.cmd specifically which consists of a couple of commands:
One to start the storage emulator and another to show some of the basic commands that the emulator supports. You can run "AzureStorageEmulator.exe stop" to stop the current instance. If you have closed the console, running the .cmd file will result in a message telling you that the emulator is already running.
One important thing that this shows is never rely on the format or structure of an Azure storage URL. The ones for the Emulator are different and you will break if you rely on - for example - the first part of the path ("devstoreaccount1" here) being the name of the container. Some documentation may tell you that this is how the URL is composed, but always use one of the client libraries / wrappers / something that stops you from picking apart the URL yourself. If you don't whatever code you write may not work against the Emulator, which will frustrate you when you have a desire to work on it when you're one of those places where there's no Internet access.
(You could even follow the instructions in the aside earlier to drill-down into the SQL instance that's used by the Emulator and find where the blob is physically stored by the Emulator. Hint, it'll look something like this: c:\users\robertwray\appdata\local\azurestorageemulator\blockblobroot\1\43312ce8-c824-48ec-8267-1174f5a69cb3).
Fangh Thanks for writing, we love feedback and questions for our developers!
This was a problem I ran into as well, and was surprised at the results. That seems to happen a lot during development - things make sense, there are just twists and turns that aren't reasonable to know before one dives in.
The answer is no and yes.
1) Developers cannot own files in the root sdcard (ie /storage/emulated/DCIM or /mnt/sdcard or /mnt/sdcard2 or /storage/ext_sd) due to a limitation in the android OS.
2) Developers can access files within a specified folder on the sdcard by requesting permissions through the android manifest and using the wave sdk to prompt the user to explicitly give access.
An example project / branch is here:
-Example/tree/sdcard
The sdcard_root branch was a variation of this where I tried some additional ways of accessing, but seemed to make progress only when manually chmoding the files on my device through adb, a process that couldn't ship to end users.
with the example trying to write and read from the directory $"/mnt/sdcard/Android/data/Application.identifier/files/testingfoo"; in the file SampleInit.cs I beleive the variation of the path ar filePath = $"/storage/ext_sd/Android/data/Application.identifier/files/testingfoo"; should also work:
Thanks!
-Alex
35fe9a5643