Hounshell
Hounshell

Reputation: 5459

What is the best location for storing data across applications

I have applications A and B (and some day C). Both need read/write access to some data. It's not sensitive, but at the same time I don't want it to be in the users face (like their download folder or anything). I also need to support phones with or without SD cards. I also have no idea what order the applications are installed (A then B, or B then A).

What's the best way to store this?

SharedPreferences seem like a good idea, but from what I understand they can only really be defined with a shared package name, and if that package is A, then B won't be able to use them until A is installed.

Internal storage was my next idea, but I don't know what folders are appropriate for this.

Edit - Clarifying requirements:

Apps A, B, and C all use the same data and need to share it amongst themselves. Whatever application is installed first should create this data and then all other applications should access that. None of the applications requires any of the others to be installed.

Upvotes: 0

Views: 262

Answers (1)

waqaslam
waqaslam

Reputation: 68187

You cant get access to internal storage (unless your device is rooted) for cross-app file access, except for app's own internal cache/file directory(s).

in your case, there are two options i can recommend.

  1. use ContentProviders to offer app's data to other apps.
  2. use External Storage (sd card) to save your data (not in app's cache directory) and let your apps read/write it independently

Upvotes: 3

Related Questions