AFAIK, ACTION_SENDworks only for actions, not for services. Therefore, you will need to create an activity that separates things. However, if everything you do displays Toastand does not have a valid activity user interface, you can use Theme.NoDisplayto suppress the activity user interface otherwise:
<activity android:name="TwitterSender"
android:label="@string/sender_name"
android:theme="@android:style/Theme.NoDisplay">
<intent-filter android:label="@string/sender_name">
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text/plain" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
You can see a complete example of this technique in one of my sample books .
source
share