Search code examples
androidcordovaphonegap

How to add my application to the list of applications that can open images?


When an application on a device tries to share an image, opens a list of applications that can do something with that image: publish it on social networks, edit, etc. What should I add to the manifest file of my application in order to add my application to this list? And, basically, it is interesting what to add to the config.xml in the PhoneGap project.


Solution

  • In order to register your application capable to do certain tasks like open images from storage, you need to add the following code inside the activity tag that can do that task:

    <activity android:name=".MyImageActivity">
    <intent-filter>
        <action android:name="android.intent.action.SEND" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:mimeType="image/*" />
    </intent-filter>
    </activity>
    

    Intent filters inform the system what intents an application component is willing to accept.

    You can find more information on the official developer website: https://developer.android.com/training/sharing/receive