I have two own apps, App A and App B. An activity of App A, open App 2 by passing a String.
Code App1:
Intent launchIntent = getMainActivity().getPackageManager().getLaunchIntentForPackage("com.example.app2");
if (launchIntent != null)
{
launchIntent.setAction(Intent.ACTION_SEND);
launchIntent.putExtra("stringApp1ToApp2", "myString");
launchIntent.setType("text/plain");
startActivity(launchIntent);
}
Code App2:
Bundle parameters = this.getIntent().getExtras();
if(parameters != null)
{
String b = parameters.getString("stringApp1ToApp2", "stringDefault");
}
Works correctly.
My problem is when I want to send a String from App2 to App1. In application 2 there is a button, that when you click you have to close the application (finish ()) and send a string to application 1. But do not open App1 from the beginning..
Any ideas?
Thank you in advance.