I have an app I made on my old phone. It creates a folder called LocationTracker. When Im stepping through the code it says the folder exists. But I cant seem to browse to it when I connect my phone to the computer. I just checked my file explorer on my phone and i can browse to the folder there as well. According to that it is under the sd card, but i just cant see it on my PC.
Im rooting around in my file explorer on my phone. There appears to be 2 sd card folders. One is called sdcard1, and that seems to be my actual sd card. The other is called sd card. I think its an emulated one. I use Environment.getExternalStorageDirectory(), i thought that returned the sd card if one was available. If that is the case why is it using the emulated folder instead of the actual sd card folder? How do I fix this?
From Android documentation:
In devices with multiple "external" storage directories, this directory represents the "primary" external storage that the user will interact with. Access to secondary storage is available through
The rest of the sentence is sadly missing. However the methods are Context.getExternalFilesDirs() and Context.getExternalMediaDirs().
Related
On my Samsung devices I put a file in the /Download folder. When I select the file within my app (via a file browser), the file is called /storage/emulated/0/Download/myfile.db. This name is stored in my app settings.
At the start of the app the file should be opened. First the app checks if the file exists. In some cases, say once every 2 weeks, the file is said to be not existing! This happens also at my friends mobile since half a year.
Why is that happening? For years everything ran smoothly.
This code runs for 6 years. Of course I added the permissions stuff.
Your help is much appreciated!
You can't use the Download as an guaranteed storage place for your files. You should use the Internal storage for the app. This is what Google has written about the download folder:
This space is called external because it's not guaranteed to be accessible—it is a storage space that users can mount to a computer as an external storage device, and it might even be physically removable.
Here you can read more about the Internal storage and the External storage in Android.
Here is some more information about the Download folder from Google.
Caution: The external storage might become unavailable if the user removes the SD card or connects the device to a computer. And the files are still visible to the user and other apps that have the READ_EXTERNAL_STORAGE permission. So if your app's functionality depends on these files or you need to completely restrict access, you should instead write your files to the internal storage.
The VS emulator does not seems to be showing the SD card in the storage menu or through code. any idea how to get it working. even if we go through the SD card menu on the emulator options and provide a folder it doesn't seems to be working.
I first had to 'Pull from SD Card' which seemed to create the required hierarchy under the folder I identified. Then I did a 'Push to SD Card'. Still didn't behave entirely as I expected since no external storage was listed under settings. I just was trying to copy files across and this allowed me to do that.
I have been searching over the StackOverflow how to get specific paths, but I only found solutions about External Storages (SD cards). I need to create and read data from internal storage (in-built memory), but I can't reach the proper path.
I want to create folder programatically in this folder shown in a picture
so the user of my app can put there .csv files used to import their contents to database, and get .csv file exported from database.
I have tried my own attempts but they did not work.
So my question is: How can I take a path of the folder shown in a picture for creating my desired folder and files there?
Thanks in advance.
I only found solutions about External Storages (SD cards)
External storage is not removable storage on most Android devices.
I want to create folder programatically in this folder shown in a picture
That is showing external storage, as is viewed from a Windows desktop or notebook by means of a USB cable or other MTP-based connection.
There are a variety of ways of working with external storage.
I have an Android application which needs some data from the SD and I check on entry that the files are there with File.exists() method and checking the SD card isnt either UNMOUNTED or SHARED. This works fine on my device, but have gotten feedback that on other device its showing the Toast that indicates that no data is present.
My questions are:
1 - Is there a way this checks can indicate that the SD is not mounted or shared even after it has been unplugged from the PC?.
2 - Is it possible that getExternalStorageDirectory() resolves to internal storage? I know how this sounds, but people have told me that the app works on some devices when copying the data to internal storage instead of external one, even though i keep telling them that shouldn't happen.
On many devices getExternalStorageDirectory() does not give you the SdCard but resolves to internal storage often called /sdcard or /storage/sdcard0. It does not matter if you
put a microSD in the device. Those paths stay the same and are valid.
If you put in a microSD than that can be mounted under many names e.g:
, "/mnt/sd-ext
, "/mnt/sdcard-ext
, "/mnt/external_sd
, "/mnt/extsd
, "/mnt/extSdCard
, "/mnt/sdcard2
There is no function to determine the sdcard.
You have to give your users the opportunity to select the storage directory.
I just want to view the files(especially the .png files) associated with one of the application in my mobile. The application is actually installed(moved) in the SD card.
The issue is ..I could not find the application in the SD card. I am using a file browser called 'File Manager' to browse through the SD card. Can someone help me on this.
It should be here:
/mnt/sdcard/Android/data/your_package_name/
Some hardware implements the path to the external storage different.
/mnt/sdcard/Android/data/your_package_name/
/mnt/sdcard-ext/Android/data/your_package_name/
You may be able to get a better view of what is on the device by using the ADB Shell. If you still have trouble at this point trying running grep or find from the shell.
UPDATE
Most of the time the files associates with your application are in the directory with your application. The application is installed in /data/data/your.package.name/. However you will need root access to get here if you are on a phone, I think the emulator lets you get here. As far as external storage... yea its a pain, to much fragmentation in the market. You have to programmatically check the location of the external storage.
On my device with Android 2.3.6 apps moved on the SD card are located into a directory named .android_secure as .asec files (see http://www.fileinfo.com/extension/asec).
They are not visible from the standard "Archive" browser which shows the hidden directory as empty.
The files are also encrypted so I guess no access to the images within is possible.