Monday, 25 August 2014

MAKING YOUR APP VISIBLE IN ANDROID GALLERY FOR SHARING

Hi all !!! when you see the Share Icon in Android Gallery it usually displays the application which has the capability to share a message , image, Video, or whatever data it is. How the gallery actually identifies the application which is capable of sharing.




when you dig through the android source code for Gallery you will see a java file named ShareActionprovider.java this file has the tendency to update the menu in Action Bar in gallery which shows the Application.

what actually happens?
                       
                         Whenever the method public void setShareIntent(Intent shareIntent) in ShareActionProvider.java is invoked (the snippet is shown below)

    public void setShareIntent(Intent shareIntent) {
        ActivityChooserModel dataModel = ActivityChooserModel.get(mContext,
            mShareHistoryFileName);
        dataModel.setIntent(shareIntent);
    }


the ActivityChooserModel.setIntent will check for all the apps which is capable of sharing i.e it checks all the AndroidManifest.xml file of the Apps which has set share INTENT more precisely for this TAG,

                  android:name="android.intent.action.SEND" 

if this Action filter is present in the welcome Activity then this app will be shown in the gallery of your device. 



Author
G Hari Prasath
Project Engineer

No comments:

Post a Comment