1

I am working on android Intent class to implement the 'Invite Friends' screen. I used the below code for it.

The above code returns me the apps like bluetooth, flipboard, facebook, whatsapp etc.

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.invite_friends));
sendIntent.setType("text/plain");

Intent chooser = Intent.createChooser(sendIntent,getString(R.string.invite_send_tittle));

if (sendIntent.resolveActivity(getPackageManager()) != null)
{
    startActivity(chooser);
}

What I need is only messaging(sms, whatsapp, twitter etc.) and email apps. How to get only messaging and email apps?

In short I am looking for invite options like WhatsApp.

Thanks, Aditya

AdityaJ
  • 59
  • 5
  • http://stackoverflow.com/a/18585798/793943 check this ans – Sush May 29 '16 at 05:50
  • @sush: Thank you for responding. But I need all the invite apps that whatsapp gives when we click on its invite friends link. – AdityaJ May 29 '16 at 12:21

1 Answers1

0

I would not do that since who knows how the user can communicate with friends - Twitter, Instagram, etc. As well there are millions of messengers and there is no way in Intent say I need a messenger.

If you still want to do selector for specific apps then you need own app selector with next steps:

  1. Query all possible apps that are able to share text (Is there any way to query an specific type of Intent Filter capable apps?)
  2. Create own bottom sheet, dialogue or new screen with list
Community
  • 1
  • 1
Eugen Martynov
  • 19,888
  • 10
  • 61
  • 114
  • Thank you for answering. In my phone, when I use the Intent code(mentioned above), I get flipboard, bluetooth also in the invite apps list but this is not the case when I click on invite button of whatsapp. I too want to filter only such apps. – AdityaJ May 29 '16 at 08:20
  • It was an example how to find apps that have intent filters. In particularly it looks for the apps that can show some information from a webpage. Sure thing WhatsApp developers did their job correctly and show only apps that they want to show – Eugen Martynov May 29 '16 at 09:14