简体   繁体   中英

Accessing application data space

I am making a application wherein when I download the file through my application it gets downloaded inside my application data space. I am doing this basically because the files downloaded will not be accessed by users as they can access it if its stored in sdcard or internal memory. So my question is that I want to open the file when user taps on the file by any third party application.ie. when the file is downloaded it will pop to open or not.If tapped on open then it should open by some other 3rd party application. for eg if i download abc.doc then it should ask me to open through various readers.

Is this possible to do? and if not what solution can i implement? Does this require the device to root..?

I am doing this basically because the files downloaded will not be accessed by users as they can access it if its stored in sdcard or internal memory.

First, "internal memory" is "application data space", assuming "application data space" refers to file storage and not RAM. There are only two places that you can write to in Android: internal storage and external storage.

Second, users who want to can access your file even on internal storage, such as by rooting their device.

So my question is that I want to open the file when user taps on the file by any third party application.ie. when the file is downloaded it will pop to open or not.If tapped on open then it should open by some other 3rd party application. for eg if i download abc.doc then it should ask me to open through various readers.

You could elect to make the file be MODE_WORLD_READABLE when you create it using openFileOutput() . This may allow some third-party applications to access the file. Or, you could implement a ContentProvider to serve this file. Either of these will also allow the user to access the file (eg, via "share" options in those viewer apps), which runs counter to your original aim.

The only way you can have a file that is not accessible by users except through your app is if your app is the one to view (or otherwise work with) the file. And, as I noted above, even then rooted device owners can still elect to get to the file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM