我有我的android应用(基于反应式),并且第一次在未在后台运行的情况下运行深层链接效果很好,但是当该应用在后台运行并且我点击深层链接时,链接甚至都无法打开应用程序。。。我什至不知道从哪里开始这个错误,我在生命周期事件中尝试了一些console.logs
,但它们甚至没有运行。
请指导我,我应该在哪里寻找该问题以及如何解决它,谢谢!
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);
}
})
}