I currently have an Activity class that has the following intent-filter:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.LAUNCHER" />
<data android:mimeType="image/*"></data>
</intent-filter>
This causes my application to show up in the Share-Via menu from the Gallery. Which is all good.
Now, I don't actually need want this to be an Activity, as it requires no user interaction. Instead, I want to make it into a service that is started in the same way by the Share-Via menu in the Gallery. So I have moved the intent-filter inside the "service" tag like:
<service ...>
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.LAUNCHER" />
<data android:mimeType="image/*"></data>
</intent-filter>
</service>
However, now I no longer see the app in the Share-Via menu! Why is that? What do I need to change to list the service in the Share-Via menu?
That's because Android calls
startActivity()
method when user clicks on Share menu item. You can create a transparent activity and start the service from it.