Skip to content

Linking.openURL does not open the app #37021

@folin03

Description

@folin03

Description

I'm using Linking.openURL in index.js to open my app on certain background data notification.
I can open the app using with Deep Link Tester app.
But cannot open it via Linking.URL()

Testing on real device running Android 11

index.js

messaging().setBackgroundMessageHandler(async remoteMessage => {
  console.log(
    'FCM message handled in the background!',
    remoteMessage,
    'platform:',
    platform,
  );
  const url = 'aculabwebrtcdemo://';
  await Linking.canOpenURL(url).then(supported => {
    console.log('supported? :', supported);
    if (supported) {
      Linking.openURL(url)
        .then(aa => console.log('openURL resp.:', aa))
        .catch(err => console.log('openURL error:', err));
    } else {
      console.log('url not valid');
    }
  });
});

Metro output after receiving background notification gives me:

 LOG  FCM message handled in the background! {"data": {"callType": "request", "callee": "g1773", "caller": "demoUser7378"}, "from": "863834115461", "messageId": "0:1682075334341759%f81bab71f9fd7ecd", "sentTime": 1682075343319, "ttl": 2400000} platform: android
 LOG  supported? : true
 LOG  openURL resp.: true

the app does not open.

AndroidManifest

<manifest xmlns:android="http://schemas.android.com/apk/res/android">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.BIND_TELECOM_CONNECTION_SERVICE"/>
    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />
    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.MANAGE_OWN_CALLS"/>
    <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>

    <queries>
        <intent>
            <action android:name="android.intent.action.VIEW" />
            <data android:scheme="aculabwebrtcdemo"/>
        </intent>
    </queries>

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="false"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustPan"
        android:exported="true">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <!-- Accepts URIs that begin with "aculabwebrtcdemo://” -->
            <data android:scheme="aculabwebrtcdemo"/>
        </intent-filter>

      </activity>
      <service android:name="io.wazo.callkeep.VoiceConnectionService"
        android:label="Wazo"
        android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
        android:foregroundServiceType="camera|microphone"
        android:exported="true"
      >
          <intent-filter>
              <action android:name="android.telecom.ConnectionService" />
          </intent-filter>
      </service>

      <activity android:name="com.reactnativeaculabclient.IncomingCallActivity" />
      <service android:name="com.reactnativeaculabclient.IncomingCallService"
        android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"
        android:foregroundServiceType="camera|microphone"
      />
    </application>
</manifest>

React Native Version

0.71.6

Output of npx react-native info

System:
OS: macOS 13.3.1
CPU: (8) arm64 Apple M1 Pro
Memory: 75.70 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 19.7.0 - /opt/homebrew/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.5.0 - /opt/homebrew/bin/npm
Watchman: 2023.02.20.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.12.0 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.3/14E222b - /usr/bin/xcodebuild
Languages:
Java: 11.0.16.1 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.6 => 0.71.6
react-native-macos: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

not easy to reproduce, I'm looking for recomendation what to try.

Snack, code example, screenshot, or link to a repository

code in main description.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions