Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect from Flutter Web App in Mobile Browser(Safari, Chrome on iOS) to Mobile App

I have two apps that need to communicate through a deep link: A Flutter Web Application and a Flutter Mobile App on iOS.

Basically, the flow needs to be that I click a button in the Web app running on a mobile browser, which is then supposed to trigger the mobile app to launch.

I've followed the specified instructions for setting up deep links and have 2 observations:

  1. Everything works perfectly on Android.
  2. If I tap on the link in any other iOS app (Calendar, MS Teams, etc.) it works perfectly fine. This leads me to believe that the deep linking has been setup correctly.

The issue i'm facing is that I need to get the link to work from my WebApp.

I'm using the Flutter url_launcher package to open the link with the launch() function.

Does anyone have any insights on what I would need to do to get the deep linking working from the iOS browsers? Any help would be appreciated. :(

Flutter code from my WebApp that I'm using to launch the url:

final urlToLaunch = Uri.encodeFull(
    'https://url-to-my-app'
);
await launch(
  urlToLaunch,
  universalLinksOnly: true,
);

I haven't shared much code because I'm not sure what would be useful.

like image 290
Joshua Mark Furtado Avatar asked Aug 31 '21 01:08

Joshua Mark Furtado


1 Answers

Deep link

Use this flutter package uni_links

Try to use deepLink i.e instead of https:// use custom scheme myownscheme://

await launch(
 'myownscheme://example.com/path?q1=v1&q2=v2',
  universalLinksOnly: false,
);
like image 68
Bharath Avatar answered Oct 14 '22 04:10

Bharath