Android Question Send text between apps

Rusty

Well-Known Member
Licensed User
Longtime User
I have a Java app (Android Studio) and a B4a app.
I need to send text from the Java app to the B4a app.

In my Java code I have:
B4X:
                Intent sendIntent = new Intent();
                sendIntent.setAction(Intent.ACTION_SEND);
                sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.";
                sendIntent.setType("text/plain");
                startActivity(sendIntent);

I have seen Erel's example Post#7

B4X:
Dim in As Intent
in.Initialize(in.ACTION_SEND, "")
in.PutExtra("android.intent.extra.TEXT", "This is my text to send.")
in.SetType("text/plain")
in.WrapAsIntentChooser("Share Via")
StartActivity(in)

Both actions say ACTION_SEND.
I'm confused as to how:
  • identify which app is sending and which is receiving
  • How to execute the receive end within the B4a app
Any suggestions are appreciated.
Also, if there is a sample app that sends and/or receives text from another app, that would also be appreciated.
Regards,
Rusty
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…