我如何检查安装在 React Native 代码中的应用程序 [英] How can i check app installed in react native code
本文介绍了我如何检查安装在 React Native 代码中的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试在我的本机项目中检查其他应用程序安装,我使用的模块如下:https://www.npmjs.com/package/react-native-check-app-install但总是出现这个错误:无法读取未定义的属性pkgName"这是我的代码:
i tried to check other app install in my react native project, I'm used module like: https://www.npmjs.com/package/react-native-check-app-install But always got this error: Cannot read property 'pkgName' of undefined Here is my code:
AppInstalledChecker
.isAppInstalledAndroid('com.skype.raider')
.then((isInstalled) => {
// isInstalled is true if the app is installed or false if not
console.log('App Skype status: ', isInstalled);
});
任何人都可以向我推荐一种方式,以便在 React Native 中检查应用安装(均:iOS/android)
Anyone can suggest me one way so check app install in react native (both: iOS/android)
推荐答案
安装这个
https://github.com/KjellConnelly/react-native-shared-group-preferences
和
async check() {
try {
await SharedGroupPreferences.isAppInstalledAndroid("com.farsitel.bazaar")
// IF IS INSTALL
} catch (e) {
// IF IS NOT INSTALL
}
}
这篇关于我如何检查安装在 React Native 代码中的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文