android - React Native - 当应用程序不在后台时,深度链接不起作用(Android、iOS)

标签 android ios react-native deep-linking

  • 如果应用在后台

    specific screen will open.

  • 如果应用程序不在后台或终止应用程序

    it will show first screen only.

Linking.getInitialURL() is return null

最佳答案

如果您想在应用被终止或尚未启动的情况下进行重定向,请找到以下简单的解决方案:

// Don't forget to import 

    import {
      Linking
    } from 'react-native';



  useEffect(() => {
    const getAsyncURL = async () => {
      const initialUrl = await Linking.getInitialURL();
      if (initialUrl != undefined && initialUrl != null){
         // Handle initialURL as per your response and open a specific screen using navigation
      }
    };

    getAsyncURL();
  }, []);

*//上面的解决方案对我有用

关于android - React Native - 当应用程序不在后台时,深度链接不起作用(Android、iOS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62693760/

相关文章:

android - 反方向射击? - AndEngine经典教程

java - 如何在 android 中录制视频的同时绘制视频,并保存视频和绘图?

android - 我可以从应用程序本身获取已购买的 Android 应用程序的 Google Checkout 订单 ID 吗?

ios - 拒绝 : "2.23: Apps must follow the iOS Data Storage Guidelines", 我们没有在文档文件夹中保存任何数据

java - 更新新项目时如何自动向下滚动ListView控件-android studio

ios - 稍后添加 subview 以与 super View 一起动画

ios - 如何将 [didSelectRowAtIndexPath] 选中的单元格变成字符串供以后使用

android - 如何在 React Native 中从@ReactMethod 返回一个 bool 值?

reactjs - React Native TouchableOpacity OnPress 不使用循环