Android apps can be coded to allow for their functionality to be called from other apps.
<intent-filter>
in the manifest for an app flags it as having activities that may be called from elsewhere using a defined <action>
(and related String,like ACTION_SEND), <data>
(for specifying data types or URI), and optionally the <category>
.<activity android:name="ShareActivity">
<!-- filter for sending text; accepts SENDTO action with sms URI schemes -->
<intent-filter>
<action android:name="android.intent.action.SENDTO"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="sms" />
<data android:scheme="smsto" />
</intent-filter>
<!-- filter for sending text or images; accepts SEND action and text or image data -->
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
<data android:mimeType="text/plain"/>
</intent-filter>
</activity>
getIntent()
allows retrieval of calling Intent, even when between apps (should probably call in onCreate()
/onStart()
)
Transitioning to the calling activity should be done with setResult()
(to define result Intent/code) and finish()
(to close called activity)