1
votes

I am using ACTION_SEND Intent to share an android market app url link via facebook, twitter and gmail. But when i press share button other options also appers like sms, email etc. I want just Facebook, twitter and gamil to appear. Is there any way to filter that.

Thanks.

3

3 Answers

0
votes

You can get a list of the installed application on the device and check if the apps you are looking for are installed. Then give the user an option to choose the app he wants to share by

List<ApplicationInfo> packages = getPackageManager().getInstalledApplications(PackageManager.GET_META_DATA);

for (ApplicationInfo appInfo : packages) {
    if ("com.facebook.katana".equals(appInfo.packageName)) {
        // Facebook app is installed, add to options list
    }

    // Do something similar for Twitter and Gmail
}

// Show user the options list
0
votes

You can get a list of the installed application that support ACTION_SEND by

Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
    sharingIntent.setType("text/plain");
    List activities = getPackageManager().queryIntentActivities(sharingIntent, 0);

and now u can build a custom dialog with only required applications by checking if these applications are in the list or not.

Please pass the class name in intent onClick of particular application of dialog

0
votes

I found this solution for me working perfect. http://www.gaanza.com/blog/email-client-intent-android/ Thanks.