app_links 2.2.1 app_links: ^2.2.1 copied to clipboard
Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler for Flutter.
app_links #
Android App Links, Deep Links, iOs Universal Links and Custom URL schemes handler.
This plugin allows you to:
- catch HTTPS URLs to open your app instead of the browser (App Link / Universal Link).
- catch custom schemes to open your app (Deep Link / Custom URL scheme).
Getting Started #
Before using the plugin, you'll need to setup each platforms you target.
Android #
- App Links: Documentation
- Deep Links: Documentation
iOs #
- Universal Links: Documentation
- Custom URL schemes: Documentation
AppLinks #
final _appLinks = AppLinks(
// Called when a new uri has been redirected to the app
onAppLink: (Uri uri) {
// Do something (navigation, ...)
},
);
// Get the initial/first link.
// This is also useful when app was terminated (i.e. not started)
final uri = await _appLinks.getInitialAppLink();
...
// Maybe later. Get the latest link.
final uri = await _appLinks.getLatestAppLink();
Android notes:
-
Intent action is filtered by
Intent.ACTION_VIEW
. -
By default, flutter Activity is set with
android:launchMode="singleTop"
. This is perfectly fine and expected, but this launches another instance of your app, specifically for the requested view.
If you don't want this behaviour, you can setandroid:launchMode="singleInstance"
in yourAndroidManifest.xml
and avoid another flutter warmup.
Tests #
The following commands will help you to test links.
Android #
adb shell am start
-W -a android.intent.action.VIEW
-d "<URI>" <PACKAGE>
For App Links, you can also test it from Android Studio: Documentation.
iOs #
/usr/bin/xcrun simctl openurl booted "<URI>"