我知道我可以很深的链接地图,例如,我使用它,它工作得很好。但是FB信使呢?我有一个按钮,当用户单击时,我希望它打开Messenger,与某人对话。我该怎么做呢?我试过直接连接,但不起作用。
openMessenger() {
Linking.canOpenURL('https://www.messenger.com/t/name').then(supported => {
if (supported) {
Linking.openURL('https://www.messenger.com/t/name');
} else {
console.log('erro');
}
}).catch(err => console.error('An error occurred', err));
}也尝试过fb-messenger://user-thread/{user-id},但仍然没有工作。
顺便问一下,有没有办法问用户他想用哪个应用程序来打开呢?在地图的例子中,当我点击iOS上的Apple上的按钮时,我想让它知道该打开哪个应用程序,因为我不使用Apple。
发布于 2017-06-20 14:18:56
对于那些寻找答案的人来说,这个库为我工作:https://github.com/fiber-god/react-native-app-link
发布于 2018-08-23 10:58:52
Linking.canOpenURL('fb-messenger://').then(supported => {
if (!supported) {
console.log('Can\'t handle url: ' + url);
} else {
Linking.openURL("fb-messenger://user-thread/" + "facebook id");
}
}).catch(err => console.log(err)));iOS
从iOS 9开始,您的应用程序需要在Info.plist中提供LSApplicationQueriesSchemes键,否则canOpenURL将始终返回false。
设置LSApplicationQueriesSchemes =>重新启动服务器
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-share-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
<string>fb-messenger</string>
</array>

Android
若要支持Android上的深度链接,请参阅http://developer.android.com/training/app-indexing/deep-linking.html#handling-intents
发布于 2022-08-05 06:13:41
https://stackoverflow.com/questions/44548911
复制相似问题