2017-06-14 150 views
0

我知道我可以深层链接地图,例如,我用它,它工作正常。但FB Messenger呢?我有一个按钮,当用户点击时,我希望它通过与某人的对话来打开Messenger。我该怎么做?我试图直接链接,但它不起作用。React-Native Link应用程序到Facebook 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 Maps上打开的按钮时,但我希望它会询问打开哪个应用程序,因为我不使用Apple Maps。

回答

0

对于那些寻找一个答案,这个库工作对我来说: https://github.com/fiber-god/react-native-app-link

+0

u能请您分享如何ü得到它的工作?什么是Playstore ID? – WahidSherief

+0

当您在playstore(id = com.facebook.orca)上搜索应用程序时,id在链接上。为了使它工作只需按照github回购的例子,它的相当简单。 – waze

相关问题