I’d like to send arbitrary strings (not paths or URLs) between two of my company’s Android apps, but the Intent data is a URI. Presently I’m concerned with starting an Activity, but in some cases it would be nice to be able to send a query and receive a response without starting an Activity. So:
- How should I send any arbitrary string when Intent wants a URI?
- What other communication mechanisms could I use?
You can add an arbitrary string to an intent by using extras on the intent.
There are many options for extra’s, see http://developer.android.com/reference/android/content/Intent.html
To retrieve the string in your receiving activity, use
Or the appropriate getter for whatever value you set on the extra.