Domanda

I'm having 2 apps.

1st app need to store a large string data. Q. Where should I store this string, that will be acessed by 2nd app.

I'm aware of Data storage schemes in android. Do I need to store it in Internal storage or SharedPreferences? I'm aware of Creating world-readable files is very dangerous.

is there a way to share this string with only 2nd app?

È stato utile?

Soluzione

In most cases, sharing data between apps is most safely and conveniently done through content providers.

You can look here for help:

http://developer.android.com/guide/topics/providers/content-providers.html

Or here:

https://developer.android.com/training/sharing/index.html

With a provider the file remains private to one of the apps, it just provides a way for the other app to access the data. Thus any 3rd party app cannot access the file - they may access the provider instead but that is much less discoverable any you can implement some simple access control if needed.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top