Android File on Internal Storage not found - android

I'm trying to write a file in my app's android internal storage space. After so many trials, I was finally successful using this method Writing/Reading Files to/from Android phone's internal memory . However, when I go to data/data/package_name/files, I cannot find my package, and cannot even find the MyFile.txt. In fact, I can't find them anywhere in internal memory. Why is that?

Related

Get all files from external storage (including Downloads folder) on Android 10+

I'm trying to get all files from external storage. The problem is with the Downloads folder. MediaStore.Downloads returns only files that were created by my app.
I found this article: https://developer.android.com/training/data-storage/manage-all-files that in theory should help solve my issue. But I can't get that permission on my Android 10 device. It says "Activity not found."
Should I use something else (not MediaStore API) to get all files? I need to get names, sizes, and other info so I can't use the Storage Access Framework.

How to transfer txt data file from Android app to Windows

I have an Android application that generates some data (simple text file) that I would like to transfer to my PC for further processing. My understanding is that my storage options for a place to save such a file are a) internal storage or b) external storage. My device is a rooted Nexus 7 running Marshmallow, and I can't get either option to work.
With internal storage I'm able to write the file but then it's nowhere to be found using ADB or Eclipse DDMS. With external storage I'm getting FileNotFoundExceptions which I'm guessing are due to new complicated permissions, so none of Android saving file to external storage is working.
Is this possible and, if so, is there an easy way to do it?
What is your targetSdkVersion? If you target 22 and below, the new permission policy won't take effect.
It is possible to write a text file in Android and read the same in your PC using external-storage.
This app does the same.
You can find a simple example here.
If this does not work for you, kindly share your code-snippet that writes the file.

Security of files in android

We are trying to create an app which will download eBook from server and store it locally on sdcard. We tried to DRM eBooks, after we download an eBook the DRM will take care of the security of the eBook. But later due to some reasons we left the DRM concept. Now I want to know whether we can store the eBook securely in the sdcard. The user cannot do any operations in the file other than viewing. Can we store the file in some other location where the user cannot view the file at all. In iOS we can download the file inside the Bundle itself, but for android???. We tried storing the pdf as a BLOB file in DB and tried to read it from there, in that case also we need to write the file and then read it. I am really confused on this Issue, can someone suggest me a good approach on how to proceed further. Any help would be really appreciable.
Personally I've avoid the SDcard given it's pretty much open to all apps, as #commonsWare mentions having it internal storage offers the Android app sandbox security.
Have you considered IOCipher from the excellent guys at the guardian project it's build on SQLCipher and it allow you to create a encrypted virtual disk. The part I love about it is that it's a clone of the java.io libraries so you should only have minimal code changes.
Files stored on the external storage are easy to read by other applications or from user's PC. You might need to encrypt your files if you don't want anybody else to get access. Well encrypted files can be places anywhere in the system without any risks of being read.
Storing files on the internal storage in your case does not sound good, because there are still too many devices out there with the limited amount of internal storage, where every megabyte counts.
Can we store the file in some other location where the user cannot view the file at all.
Not on external storage. You can put the book on internal storage, in which case only rooted device users would have access to it outside of your app.
i) keep the files encrypted which are important to you.
ii) decrypt the files and move to the internal storage during runtime.
iii) Access your files only from internal storage.
Following these things will keep your file and method calling safe as they are accessible only to internal storage.
Example:(access moved assets files from internal storage )
file:///android_asset/ => file:///data/data/com.test.exmple/files/"
You can also try tools like quixxi that do this for you transparently.

Downloading files from webservice to specific location on android device

IDE Eclipse
Using emulators
I am downloading files from a webservice. I have no problem saving the files to the sdcard. This can then be accessed via a filemanager.
However, if there is no sdcard available I would like to save the files to 'Downloads' on internal storage. I can't seem to get the files to download to 'Downloads' as it would were you downloading from a browser.
I can however manage to save the files in the application directory on internal storage. Eg data/data/com.example.appname/files/.
The problem is this can only be access via the application.
I need the files to be available to the user to view/open after downloaded.
Is this possible? Or will the user have to have an SDCARD?
This also depends on the device + provider, some are locked so people cannot access their internal storage at all.
So if you want to cater to people without SD card, save in application directory. They cannot access if they don't have root-access. Nothing you can do about this.
This is quite normal behavior.
Best practice is warn users of their options: saving on SD card or internal storage. And mention consequences if you want.
the find the downloads folder use:
http://developer.android.com/reference/android/os/Environment.html#getExternalStoragePublicDirectory(java.lang.String)
File downloadFolder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS);
but just like others mention, if the SD-Card is not there, there's not much you can do about it, just give a warning to the user.
On the link I posted there's good examples on how to check the existence of the directory and availability of it.

Store video files on internal or sd card memory with protection?

I have an issue with my app .I want some video files to be stored in sdcard or internal memory in such a way that it could be read only by my app.
And other app may not read or copy the videos.Is there any simple way to do this?
The most protection you're going to get is through packaging the data with your app. Even this won't protect the files if the device is rooted. All other storage areas are exposed to browsing by the user.

Categories

Resources