open a url on browser and then coming back to app

1,243 views
Skip to first unread message

Zahra Hosseini

unread,
Sep 14, 2020, 9:41:48 AM9/14/20
to Flutter Development (flutter-dev)
Hi, please help me
I need to open a url on the browser and user would do something and then i should return back to the app.
also i should come back to the related page according to what user has done on the web.
thanks in advance!

Rhythm Varshney

unread,
Sep 14, 2020, 10:20:23 AM9/14/20
to Flutter Development (flutter-dev)

Zahara , email me at rhyt...@gmail.com

Jeremy West

unread,
Sep 16, 2020, 7:20:41 AM9/16/20
to Flutter Development (flutter-dev)

With url_launcher package: https://pub.dev/packages/url_launcher

With specific note to this comment on url_launcher package:
By default, Android opens up a browser when handling URLs. You can pass forceWebView: true parameter to tell the plugin to open a WebView instead.

Hugo van Galen

unread,
Sep 16, 2020, 8:24:56 AM9/16/20
to Zahra Hosseini, Flutter Development (flutter-dev)
You could look into deeplinks / dynamic links to redirect the user back into your app after finishing on the web, but that could feel a bit clunky. (And if you want this to work on iPhone it may not work at all, I recollect that deep-linking to your app doesn't work from Safari -- but I could be wrong.)

You can always use a WebView and monitor the URL changes. At the end of doing something, you can redirect the web page to a specific URL (like, for example, with "finished=1" as query parameter) so your code can pick that up and can detect it should close the webview and the user will be back in the app. You could add more interesting data to return to your app in that URL too (for example, "https://example.com/something?finished=1&resultCode=124&message=Foo").

Hope this helps.

--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/2223a029-7552-4a53-aaea-23836f28626an%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages