atereshkov
atereshkov

Reputation: 4555

How to launch an external app in Flutter (like Skype)

I've tried to use url_launcher package but it looks like it's working only for default schemes like http, mail, sms, tel for some reason.

String phoneURL = 'skype:skype_login';
if (await canLaunch(url)) {
   await launch(url);
}

So any chance to open external app (like Skype) from Flutter code?

Upvotes: 4

Views: 3094

Answers (1)

atereshkov
atereshkov

Reputation: 4555

Ok, looks like I got it. It's not documented yet or I just haven't seen the information. I've got some related info from this issue.

First of all, in case of Skype (or any external popular app that has URI scheme), to run it on iOS, add the following code to your project Info.plist file in the Xcode:

<key>LSApplicationQueriesSchemes</key>
<array>
    <string>skype</string>
</array>

No special steps required for Android.

In addition you could check whether the app was opened, so it returns a bool that indicates if the launch call is successful:

if (await canLaunch('skype:username')) {
  final bool nativeAppLaunchSucceeded = await launch(
    'skype:username',
  );
  if (!nativeAppLaunchSucceeded) {
    // Do something else
  }
}

Upvotes: 3

Related Questions