0

I use this code for joining to group in WhatsApp, but if I am already in a group, then after opening I receive a toast that I am already in a group. How just open group how to open a group without toast?

Intent intentWhatsAppGroup = new Intent(Intent.ACTION_VIEW); Uri uri =
Uri.parse("whatsapp://chat?code=***GroupID***");
intentWhatsAppGroup.setData(uri);
intentWhatsAppGroup.setPackage("com.whatsapp");
startActivity(intentWhatsAppGroup);
Pavlo Kravchenko
  • 345
  • 5
  • 20

1 Answers1

0

You have to use the group whatsapp link. In your code you have to have somewhere where the user can paste the group link and then in your code change the line that parses the Uri like

Uri.parse("https://chat.whatsapp.com/<group_link>");
DANIEL SSEJJEMBA
  • 342
  • 5
  • 15
  • Just as I said, displays a message that I am already a member of the group. – Pavlo Kravchenko Feb 04 '19 at 14:54
  • Whatsapp doesn't really have any open api for direct group chat from an external application as far as I know. You can only do so much for now but I don't think there was any intention for that type of usage thus far... – DANIEL SSEJJEMBA Feb 04 '19 at 15:33