Last updated:
0 purchases
link kit
link_kit #
Flutter plugin for Deep Link/App Link/Universal Links.
⚠️⚠️⚠️ #
link_kit 1.0.0 配置并不与 0.0.x 兼容,请手动删除 0.0.x 配置
因为 Android 的 manifestPlaceholders 能力有限,又懒得写需要兼容各版本的 Gradle 插件,所以默认只支持配置一个 DeepLink/AppLink/UniversalLink
Android #
文档
创建指向应用内容的深层链接
添加 Android 应用链接
simonmarquis/Android App Linking
Statement List Generator and Tester
配置
# 不需要做任何额外接入工作
# 配置已集成到脚本里
copied to clipboard
App Links
assetlinks.json - 通过 https://${your applinks domain}/.well-known/assetlinks.json 链接可访问
示例:
https://${your applinks domain}/universal_link/${example_app}/link_kit/
[
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "your_app_package_name",
"sha256_cert_fingerprints": [
"your_app_package_fingerprint_sha256"
]
}
}
]
copied to clipboard
获取 Android 签名信息
测试
# Deep Link
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "flk:///power"
copied to clipboard
# App Link
adb shell am start -a android.intent.action.VIEW -c android.intent.category.BROWSABLE -d "https://www.yourdomain.com/universal_link/example_app/link_kit/power"
copied to clipboard
iOS #
文档
Support Universal Links
配置
# 不需要做任何额外接入工作
# 配置已集成到脚本里
copied to clipboard
Universal Links
apple-app-site-association - 通过 https://${your applinks domain}/.well-known/apple-app-site-association 链接可访问
示例:
https://${your applinks domain}/universal_link/${example_app}/link_kit/
{
"applinks": {
"apps": [],
"details": [
{
"appID": "${your team id}.${your app bundle id}",
"paths": [
"/universal_link/${example_app}/link_kit/*"
]
}
]
}
}
copied to clipboard
⚠️ 很多 SDK 都会用到 universal_link,可为不同 SDK 分配不同的 path 以作区分
测试
# Deep Link
xcrun simctl openurl booted flk:///power
copied to clipboard
# Universal Links
xcrun simctl openurl booted https://www.yourdomain.com/universal_link/example_app/link_kit/power
copied to clipboard
Flutter #
配置
dependencies:
link_kit: ^${latestTag}
# link_kit:
# git:
# url: https://github.com/RxReader/link_kit.git
link_kit:
deep_link: ${your deep link scheme}:///
android:
app_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置
ios:
universal_link: https://${your applinks domain}/universal_link/${example_app}/link_kit/ # 可选配置
copied to clipboard
安装
# Android
# 修改配置后,必须执行 flutter clean 清理中间编译产物 BuildConfig.java
# step.1 切换工作目录
cd example/
# step.2
flutter clean && flutter pub get
copied to clipboard
# iOS
# 首次/修改配置后,必须执行 pod install 让配置生效
# step.0 安装必要依赖
sudo gem install plist
# step.1 切换工作目录
cd example/
# step.2
flutter clean && flutter pub get
# step.3 执行脚本
cd ios/
pod install
copied to clipboard
编码
_linkClickSubs = LinkKitPlatform.instance.linkClickStream().listen((String event) {
if (kDebugMode) {
print('linkClick: $event');
}
setState(() {
_link = event;
});
});
LinkKitPlatform.instance.getInitialLink().then((String? value) {
if (kDebugMode) {
print('initialLink: $value');
}
setState(() {
_link = value;
});
});
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.