Mr. Oak
Mr. Oak

Reputation: 347

Is it possible to always allow "Open this page in WhatsApp" dialog on iOS Flutter App?

I'd like to launch Whatsapp from my Flutter app for a specific contact on the user's device. I'm able to do that successfully using url launcher as described in many questions on the subject (like this one this one).

The way it works, it opens an in-app web browser, which then prompts the user to open Whatsapp. On iOS, it then prompts the user with a dialog "Open this page in WhatsApp?"

enter image description here

Is there a way to always allow that? So that the user doesn't have to hit that each time they want to connect to someone on Whatsapp from my app?

Upvotes: 0

Views: 298

Answers (1)

Aditya Thakur
Aditya Thakur

Reputation: 1106

Use the LaunchMode enum which is used to state the desired mode to launch a URL.

Future<bool> launchUrl(
Uri url,
{LaunchMode mode = LaunchMode.externalApplication}
);

LaunchMode.externalApplication is supported on all platforms. On iOS, this should be used in cases where sharing the cookies of the user's browser is important, such as SSO flows, since Safari View Controller does not share the browser's context.

Upvotes: 1

Related Questions