Skip to content

Linking.getInitialURL() not working in Android when the app is closed #26383

Closed
@injas427

Description

@injas427

I'm implementing deeplinking and when the app is closed then Linking.getInitialURL() isn't getting triggered. I'm facing this issue only in Android device and iOS is working fine. There is no issue when the app is in background. I've issue only when the app is closed. I've tried Linking.addEventListener("url", this.handleOpenURL) too. But issue still exists. Even Linking.addEventListener("url", this.handleOpenURL) isn't getting triggered in Android

React Native version:

System:
    OS: macOS 10.14.5
    CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
    Memory: 18.70 MB / 10.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.15.3 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.4.1 - /usr/local/bin/npm
  SDKs:
    iOS SDK:
      Platforms: iOS 12.2, macOS 10.14, tvOS 12.2, watchOS 5.2
    Android SDK:
      API Levels: 23, 27, 28, 29
      Build Tools: 27.0.3, 28.0.3, 29.0.1
  IDEs:
    Android Studio: 3.4 AI-183.6156.11.34.5692245
    Xcode: 10.2.1/10E1001 - /usr/bin/xcodebuild
  npmPackages:
    react: 16.8.6 => 16.8.6 
    react-native: 0.60.4 => 0.60.4 
  npmGlobalPackages:
    react-native-cli: 2.0.1
    react-native-create-library: 3.1.2
    react-native-git-upgrade: 0.2.7

Expected Behavior

When the app is launched using the deep linking, then Linking.getInitialURL() should trigger

Example code snippet

Linking.getInitialURL().then(url => {
            this.navigate(url);
        }).catch(e => {
            console.warn(e.message);
        })

Neither then nor catch is triggered

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions