简体   繁体   English

收不到firebase动态链接

[英]Not receiving firebase dynamic link

Currently I am doing a project that calls a secondary app and I launch the 2nd app through InAppWebView.目前我正在做一个调用辅助应用程序的项目,并通过 InAppWebView 启动第二个应用程序。 While the 2nd app is facing the user, the inappwebview is still running and sends live update, which I am capturing to trigger events, for example like it will send payment complete, allowing me to trigger to go summary page.当第二个应用程序面向用户时,inappwebview 仍在运行并发送实时更新,我正在捕获它以触发事件,例如它将发送付款完成,允许我触发到 go 摘要页面。

The issue I am having is, I am unable to smoothly transit back to my app.我遇到的问题是,我无法顺利转回我的应用程序。 So there are two ways that I found that allow me to go back to the app.因此,我发现有两种方法可以让我将 go 返回应用程序。

One, launch the URL using my dynamic link but this method I am unable to receive the link.一,使用我的动态链接启动 URL 但是这种方法我无法接收链接。

Second, to launch it through external application like chrome.其次,通过chrome等外部应用程序启动它。

The second method works perfectly other than the fact that the screen jumps to chrome.除了屏幕跳转到 chrome 之外,第二种方法效果很好。 And it continues from where I left off.它从我离开的地方继续。

However, what I want is both, continue from where I left off and not have the jumping of the chrome.但是,我想要的是两者,从我离开的地方继续,而不是让 chrome 跳跃。 Or from what I have read the right way is to direct to the activity using intent filter.或者从我所读到的正确方法是使用意图过滤器定向到活动。 But the smooth method I am not receiving the links but the jump method I am receiving the links.但是平滑的方法我没有收到链接,而是跳转的方法我收到了链接。

Please help T - T请帮忙T-T

if you need to add dynamic links with firebase you can find the setup right in the docs and with the help with firebase_dynamic_links you can handle where to go inside your app and also can execute parameters from the link in the function below you make a stream that listen to any dynamic link clicked while the app in the background or foreground, the PendingDynamicLinkData is when the app terminated. if you need to add dynamic links with firebase you can find the setup right in the docs and with the help with firebase_dynamic_links you can handle where to go inside your app and also can execute parameters from the link in the function below you make a stream that收听应用程序在后台或前台单击的任何动态链接, PendingDynamicLinkData是应用程序终止的时间。 the business logic and how the app interacts ups to you.业务逻辑以及应用程序如何与您交互。

static Future<void> initDynamicLink() async {
FirebaseDynamicLinks.instance.onLink.listen((dynamicLink) async {
  if (dynamicLink.link != Uri.parse("uri")) {
    log(dynamicLink.link.queryParameters.toString());
    final Uri deepLink = dynamicLink.link;
    // you should handle the navigation or you logic here
  }
}).onError((error) {
  debugPrint("error from dynamic link Stream : : :: ${error.toString()}");
});
final PendingDynamicLinkData? initialLink =
    await FirebaseDynamicLinks.instance.getInitialLink();
try {
  if (initialLink != null) {
    log(initialLink.link.toString());
    final Uri deepLink = dynamicLink.link;
     // you should handle the navigation or you logic here
  }
} catch (e) {
  debugPrint('No deepLink found');
 }
}

don't forget to call this function in the main like this不要忘记这样称呼这个main

void main()async{
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
 initDynamicLink();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM