1

I have installed the same application on

  • a device running Android 7.0 (not rooted) and

  • on a tablet running Android 4.4 (root),

but nevetheless I noticed that the application data (databases/files etc) is stored in different locations on each device:

On the tablet device the files are located at: /storage/sdcard0/Android/data/com.packagename and can be easily manipulated (i.e copy, back up etc) but not on the smartphone which likely leaves the storage location being: /data/data/com.packagename which I have no access to.


I understand that it is usually stored on /data/data (protected internal app storage) or /storage/sdcard0/Android/data (storage on user's internal storage partition), else on a SD card if present. In addition, a related question has been asked here: Where Android apps store data?

My biggest surprise is why is this happening on the same application (same version - sideloaded)?

This reference page also explains how a developer can configure the default location of application data. It would have been understandable if there were different versions of the application, but here I am only dealing with the same application (i.e .apk file). Is there something I am missing here or things have changed in recent versions of Android?

My concern is that I can't access these files on /data/data without root and since these are large files and I need to back them up just in case the app data is accidentally cleared (and I have already done that by mistake :(.

Most importantly I don't want to continuously download them over again.

Note: Both devices have no external storage attached.

From the look of things the biggest obstacle is not being able to access files on /data/data (device 1), hence no backup possible...(I would appreciate if there is another reliable workaround to achieve this)

  • Hasn't it always been /data/data? Can you tell what location app data is being stored at? Do you know if the files are data files? Also how do you really know without root? – SSS Jul 8 '18 at 19:55
  • I'm certain clear data also wipes data at /sdcard/Android/data, in fact I just tried it on a certain app and it did so. Also, I think /Android/data and /data/data have different purposes. I've found that /Android/data is used more for caches/files related to ads whereas /data/data is more for private things (eg storing login info). – SSS Jul 8 '18 at 20:59
  • @SSS I get your point,but at least on the tablet I can easily back up its data, even if I clear it by mistake it won't have too much harm :) – xavier_fakerat Jul 9 '18 at 18:48
1

All apps have private storage in the protracted /data folder. Some apps choose to temporarily store data in public locations. Unfortunately I cannot say for certain what the exact results of this were, but I know the way shared data is handled changed in Android 7 for security reasons.

  • so can I possibly back up the app data stored in /data folder on this non rooted device – xavier_fakerat Jul 30 '18 at 16:51
1

As strange as it sounds, I had a successful workaround to this issue:

  • I had to manually move the necessary application data (files) from /data/data to /Android/data (with exception of shared_preferences folder and database folder i.e the normal config).

  • Second I had configure the app to use a private directory by modifying the userDefault.xml file (maybe different depending on application in question) and adding this necessary line of code:

    <int name="app_private_dir"value_"1"/>

  • I temporarily magisk'd to fully achieved this :) – xavier_fakerat Dec 24 '18 at 20:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.