Data sharing between two applications
ContentProviders are a good approach to share data between applications.
How to share data Between two Application
You can use content provider . here is detail and example
Data sharing between two application in android
Send data from Application 1 (for ex:Application 1 package name is "com.sharedpref1" ).
SharedPreferences prefs = getSharedPreferences("demopref",
Context.MODE_PRIVATE);
SharedPreferences.Editor editor = prefs.edit();
editor.putString("demostring", strShareValue);
editor.commit();
Receive the data in Application 2( to get data from Shared Preferences in Application 1).
try {
con = createPackageContext("com.sharedpref1", 0);//first app package name is "com.sharedpref1"
SharedPreferences pref = con.getSharedPreferences(
"demopref", Context.MODE_PRIVATE);
String your_data = pref.getString("demostring", "No Value");
}
catch (NameNotFoundException e) {
Log.e("Not data shared", e.toString());
}
In both application manifest files add same shared user id & label,
android:sharedUserId="any string"
android:sharedUserLabel="@string/any_string"
both are same... and shared user label must from string.xml
like this example.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.xxxx"
android:versionCode="1"
android:versionName="1.0"
android:sharedUserId="any string"
android:sharedUserLabel="@string/any_string">
How to share data between two applications with SSO?
The SAML way is to use NameID as the "primary key" to map a user in the IDP to a user in the application.
e.g. Email could be sent as the NameID for application 1 and UPN could be sent as the NameID for application 2. These would be in the assertions.
Getting info. between applications is not part of an IDP (other than using assertions) so this would have to be done via API.
Sharing data between two applications
why not you are using xml as a mediator between two application. Use XML for the communication.
Passing data between two android apps using intent
Try this:
AppA's AndroidManifest.xml:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.joy.AppA">
.
.
.
<activity
android:name="com.joy.AppA.views.activities.StartGameActivity"
android:label="Start Game">
<intent-filter>
<action android:name="com.joy.AppA.views.activities.LAUNCH_IT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value=".views.activities.DashboardActivity" />
</activity>
Then to send data to app a activity from app b, do this:
Intent i = new Intent();
i.setAction("com.joy.AppA.views.activities.LAUNCH_IT");
i.putExtra("gameRecord", gameRecord_array);
startActivity(i);
Related Topics
Switching Between Android Navigation Drawer Image and Up Caret When Using Fragments
Android Linearlayout:Add Border with Shadow Around a Linearlayout
How to Increase Storage for Android Emulator? (Install_Failed_Insufficient_Storage)
Android Locationclient Class Is Deprecated But Used in Documentation
Meaning of Choreographer Messages in Logcat
How to Add a Textview to a Linearlayout Dynamically in Android
How to Pass Arraylist of Objects from One to Another Activity Using Intent in Android
What Does Google-Services.JSON Really Do
How to Connect Android App to MySQL Database
Android: Remove Notification from Notification Bar
Android Studio: Gradle - Build Fails -- Execution Failed for Task ':Dexdebug'
What Is the Size Limit for Logcat and How to Change Its Capacity
Cannot Get Searchview in Actionbar to Work
How to Change the Radio Button Icon in an Android Radio Button Group
How to Get the Touch Position in Android
Is It a Bad Practice to Use Negative Margins in Android
How to Zip and Unzip a String Using Gzipoutputstream That Is Compatible with .Net