Unable to launch google meet via link through flutter application

1.4k Views Asked by At

I am trying to build an application where users can join google meet just with one click(I know it is easier to send a meet link via Whatsapp but I want everything in one place). I have used the url_launcher package since google meet generates a URL for every meeting. Every other URL works fine except for the google meet link. Whenever I pass the google meet URL as the parameter to the parse function, it redirects me to a "web page not available" in the emulator(even on a real device).

How do I make the user redirect to that particular meeting and join on the meet app?

final Uri url = Uri.parse("https://meet.google.com/rxf-uxca-jpx");
  void _launchUrl() async {
    if (!await launchUrl(url)) throw 'Could not launch $url';
  }
ElevatedButton(
                    child: const Text(
                      'Click here to join',
                      style: TextStyle(
                        fontSize: 25,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    onPressed: _launchUrl,
                  ),

I even made these changes in my AndroidManifest.xml file as given in the docs, I don't know if this is required or not.

<queries>
  <!-- If your app opens https URLs -->
  <intent>
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="https" />
  </intent>
</queries>
2

There are 2 best solutions below

2
On

Try below code, Its working on my machine, refer my answer here for same.

Your googleMeet function with URL:

googleMeet() async {
  const url = 'https://meet.google.com/rxf-uxca-jpx';
  if (await canLaunch(url)) {
    await launch(url);
  } else {
    throw 'Could not launch $url';
  }
}

Your Widget:

   ElevatedButton(
        child: Text(
          'Click here to join',
          style: TextStyle(
            fontSize: 25,
            fontWeight: FontWeight.bold,
          ),
        ),
        onPressed: () => googleMeet(),
      ),
1
On

Try this code. It opens google meet app on your phone. Just paste your google meet link in the url field.

googleMeet() async {
    const url = 'your google meet url link';
    final uri = Uri.parse(url);
      await launchUrl(uri, mode: LaunchMode.externalApplication);
  }