React Native APK Installer
Install an android APK from your react-native project.
This project is based on react-native-android-library-boilerplate
and react-native-install-apk
Installing ApkInstaller
- Add
react-native-apk-installer
to your project
- Install directly from npm:
npm install --save react-native-apk-installer
. - Or do
npm install --save git+https://github.com/null--/react-native-apk-installer.git
in your main project.
- Link the library:
-
Add the following to
android/settings.gradle
:include ':react-native-apk-installer' project(':react-native-apk-installer').projectDir = new File(settingsDir, '../node_modules/react-native-apk-installer/android')
-
Add the following to
android/app/build.gradle
:...dependencies {...compile project(':react-native-apk-installer')} -
Add the following to
android/app/src/main/java/**/MainApplication.java
:...// add this for react-native-apk-installer
- Simply
import ApkInstaller from 'react-native-apk-installer'
(You might also need to installreact-native-fs
package).
; try var filePath = RNFSCachesDirectoryPath + '/com.example.app.apk'; var download = RNFS; downloadpromise; catcherror console;