react-native
react-native copied to clipboard
Linking.openURL does not open the app
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.
:warning: | Newer Version of React Native is Available! |
---|---|
:information_source: | You are on a supported minor version, but it looks like there's a newer patch available. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases. |
Similar issue here. My website has been set up with deep link / universal link. If I tap the link https://myap.com, my app is opened. But inside the app, if I launch openURL(https://myapp.com), I get redirected to the default web browser. This used to work some months ago. Idk when this stopped working.
any updates about this issue ? @folin03
Any update?
I managed to get it working when the deeplinking is in event listener
RNCallKeep.addEventListener('answerCall', async () => {
Linking.openURL('aculabwebrtcdemo://videoCallScreen').catch(() => {});
RNCallKeep.removeEventListener('answerCall');
});
Similar issue here. My website has been set up with deep link / universal link. If I tap the link https://myap.com, my app is opened. But inside the app, if I launch openURL(https://myapp.com), I get redirected to the default web browser. This used to work some months ago. Idk when this stopped working.
Have you solved it now?
Same problem here for phone calls
My website has been set up with deep link / universal link. If I tap the link https://myap.com, my app is opened.
Can you help me? I'm doing the same thing, namely universal linking. I have set up everything to the point of placing the .well-known/assetlinks.json file but the app still can't open automatically when a link is clicked. The browser instead gives 2 question options to open the link via the app, browser, or other. I have to activate it through the android app settings "open supported links"> "allow app to open supported links" this must be checked in order for it to open directly when clicking the link. I don't think there is a problem with the way of getting the sha256_cert_fingerprints because universal is already half working just that it can't open the application directly. Is this related to verification? api level 33
We have same issue with opening http link. It worked some time ago and now stopped.
Same here, not working with phones.
The same problem. It does nothing but logging success open and supported yes.