@unif/react-native-upgrade
v0.2.2
Published
app update
Downloads
1
Readme
@unif/react-native-upgrade
app 版本更新
android全新
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.DELETE_PACKAGES" />
<uses-permission android:name="android.permission.ACCESS_SUPERUSER" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
Installation
npm install @unif/react-native-upgrade
Usage
import UpdateModal, { openAPPStore, upgrade, downloadApk, installApk } from '@unif/react-native-upgrade';
// ios 检测更新
await upgrade("appstre id");
// ios 打开应用商城
await openAPPStore('appstre id');
// android 下载、安装apk
downloadApk({
url: 'https://eudmtest.upbuy.com.cn/js_control/plugin/app-beta-release.apk',
path: 'file'
}).then((res) => {
installApk(res.path());
});
// ...
<UpdateModal
isVisible={true}
onCancel={() => {}}
onOk={() => {
if (Platform.OS === 'ios') {
openAPPStore('1522428117');
} else {
downloadApk({
url: 'https://eudmtest.upbuy.com.cn/js_control/plugin/app-beta-release.apk',
path: 'file',
}).then((res) => {
installApk(res.path());
});
}
}}
/>
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library