gpt4 book ai didi

android - React Native - 如果应用程序 Y 已安装,应用程序 X 如何打开应用程序 Y

转载 作者:行者123 更新时间:2023-11-29 18:25:45 26 4
gpt4 key购买 nike

如果安装了应用程序 Y,我希望我的应用程序(比如应用程序 X)想要打开应用程序 Y。并在 Android 和 iOS 中工作(如果未安装应用程序 Y,请打开 App Store/Play 商店)

我做了什么:

Linking.openURL(applicationStoreURL);

The code above success open Play Store/App Store of Application Y, but actually the application Y has been installed so i want to direct open to Application Y from Application X.

最佳答案

试试这个库

"Easily deep link to other apps in React Native. If the app isn't installed on the user's phone, open the App Store or Play Store link instead."

https://github.com/FiberJW/react-native-app-link

npm i -S react-native-app-link


import AppLink from 'react-native-app-link';

AppLink.maybeOpenURL(url, { appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
// do stuff
})
.catch((err) => {
// handle error
});

AppLink.openInStore({ appName, appStoreId, appStoreLocale, playStoreId }).then(() => {
// do stuff
})
.catch((err) => {
// handle error
});

关于android - React Native - 如果应用程序 Y 已安装,应用程序 X 如何打开应用程序 Y,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59136132/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com