How To Pass Data Both Ways Between Different Android Applications?
What's the easiest way to pass string variables from one application to another and also return values back? I have access to the source code of both apps, but it has to be two dif
Solution 1:
AIDL is one means of communication between two different applications using Interfaces
http://developer.android.com/guide/components/aidl.html
You can find a working sample in the below tutorial http://manishkpr.webheavens.com/android-aidl-example/
Solution 2:
you can use ContentProvider.This is a better way than others.
Solution 3:
SharedPreferences
might help you in this regard.
Solution 4:
I have two apps that i pass data to/from.
App1...
Intenti=newIntent("com.xxx.yyy.MESSAGE");
Bundleb=newBundle();
b.putString("AAA", getAAA());
i.putExtra("MyData", b);
startActivityForResult(i, "myProcess");
nothing fancy there...
App2...in onResume()
...
Intent i = getIntent();
if (i != null && i.getAction().equals("com.xxx.yyy.MESSAGE") {
...get the data from the bundle
}
note that the AndroidManifest.xml (for App2) has the following entries for one of the activities
<intent-filter><actionandroid:name="com.xxx.yyy.MESSAGE"/><categoryandroid:name="android.intent.category.DEFAULT"/><dataandroid:mimeType="text/plain"/></intent-filter>
Solution 5:
You can exchange messengers between two services that belong to those apps (even if the apps are from two different packages) and communicate using those messengers.
Post a Comment for "How To Pass Data Both Ways Between Different Android Applications?"