Android - Where to store downloaded content, internal and external storage?

A few separate but related questions regarding the storage of downloaded content in my application.

I have an application that downloads content from a central server. This content is sometimes premium content, or at least content in which the publisher does not want to be freely distributed. I understand that โ€œexternalโ€ storage is easily accessible, while โ€œinternalโ€ storage is protected if the phone is not rooted.

If the application is installed on the SDCARD (as mine is configured), then this "internal" storage is also physically on the SDCARD? Thus, if an installed SDCARD application uploads, say, 100 MB of content to internal storage, does it actually end up on SDCARD or end up on physical embedded device storage?

If the application is installed on SDCARD, and the "internal" storage with the downloaded content is on SDCARD, is it physically stored in open format or encrypted? I seem to remember reading that the application stored on SDCARD is encrypted. Does this also apply to "internal" storage?

(The deleted question about storing files in the same directory as Context.getDir () means that the directory system can be created and stored in the internal storage)

Is there a better approach?

+6
source share
1 answer

I did a bunch of experiments and came to the following conclusions from Android 2.2 on Motorola Droid 2:

  • When the application is installed / moved to SDCARD, it is saved as an .asec file in the hidden /.android_secure directory on the SDCARD. This is an encrypted and compressed file.
  • When an application creates data files in the "internal storage", they are stored in the deviceโ€™s internal memory, not on the SDCARD.
  • The Settings / Application Data Management dialog box for the application has the value Data - this is the amount of data that the application uses in the internal storage, which is located in the internal memory, and not on the SDCARD
  • External storage ends with SDACRD in the directory / Android / data li>
  • Deleting data from the Options / Application Management dialog really destroys everything, which means that the installed application must have sufficient knowledge / logic to handle the "data-free" situation.

My application is an application for downloading content. For me, this means that:

  • There is little real value for storing my small application on SDCARD, given that the bulk of the memory that it will consume on the phone will be in the internal memory of the device. Besides that its always good that the application can be installed on sdcard.
  • The installation package should be able to recover user-downloaded content if it is cleared by the user.
  • The concept of storing a unique installation identifier in internal memory works well until the user deletes the application data and, therefore, sets a new installation identifier for calculation. Thus, in order to be able to remember what content was downloaded to the device, a user account is required on the central server, which the user creates / registers, whenever the application starts from scratch.
+4
source

Source: https://habr.com/ru/post/897008/


All Articles