gre*_*reW 8 deep-linking react-native react-native-android
我有我的Android应用程序(react-native为基础)和深度链接第一次当我运行它而应用程序没有在后台运行时效果很好,但当应用程序在后台运行时我点击深层链接它甚至没有打开应用程序...我不确定从哪里开始这个错误我console.logs在生命周期事件中尝试了一些,但他们甚至没有运行.
请指导我在哪里寻找问题以及如何解决它,谢谢!
小智 0
componentDidMount() {
Linking.addEventListener('url', this._handleDeepLinkingURL);
this._handleDeepLinkingURL(); /* Invoking method manually on launching app very first time */
},
componentWillUnmount() {
Linking.removeEventListener('url', this._handleDeepLinkingURL);
},
_handleDeepLinkingURL(event) {
/*
console.log(event.url);
event.url will hold the url of the app if the app launched when its running in background
event param will be undefined when the app launched from kill state or first time
*/
Linking.getInitialURL()
.then(url => {
if (url && url.indexOf("?params=") !== -1) {
const paramsString = url.substr(
url.indexOf("?params=") + 8
);
alert('paramsString is : ' + paramsString);
}
})
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
508 次 |
| 最近记录: |