I need to send some string data from my one application activity to my other application activity in android and not between the activities within the same application. How to do that? What intent filters my other application need to declare? Please try to elaborate with example.....
Although you can design your own system for doing data transfers in your app, you should consider using Android's sync adapter framework. This framework helps manage and automate data transfers, and coordinates synchronization operations across different apps.
Android App Development for Beginners These storage places are shared preferences, internal and external storage, SQLite storage, and storage via network connection. In this chapter we are going to look at the internal storage. Internal storage is the storage of the private data on the device memory.
While some of the reasons apps collect your data are legitimate — like tracking how you interact with them to make your experience better and to fix bugs — the company behind the app also can sell or pass this information to third parties that then target you with ads on their platforms.
As far as I could understand from your answer you're looking for intents:
On the manifest of App A - Activity Alpha you declare a intent filter with Category DEFAULT and Action = com.your_app_package_name.your_app_name.ActivtiyAlpha
The on App B, Activity Beta you put the code to launch A and pass the data:
Intent i = new Intent("com.your_app_package_name.your_app_name.ActivtiyAlpha");
i.putExtra("KEY_DATA_EXTRA_FROM_ACTV_B", myString);
// add extras to any other data you want to send to b
Then back on App A - Activity Alpha you put the code:
Bundle b = getIntent().getExtras();
if(b!=null){
String myString = b.getString("KEY_DATA_EXTRA_FROM_ACTV_B");
// and any other data that the other app sent
}
If you're concerned with only a small amount of data, Android provides a SharedPreferences class to share preferences between applications. Most notably, you can add OnSharedPreferenceChangeListener to each application so they can be notified when the other changes the value.
Most importantly, you can't ensure that both applications are running
You can find more information on http://developer.android.com/guide/topics/data/data-storage.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With