react-native-install-apk

1.0.0 • Public • Published

react-native-install-apk

install

npm install react-native-install-apk --save

usage

import NativeModules from 'react-native';  
NativeModules.InstallApk.install(path);  

example code

you can use react-native-fs to download the apk file:

var filePath = RNFS.DocumentDirectoryPath + '/com.domain.example.apk';
var download = RNFS.downloadFile({
    fromUrl: 'apk file download url',
    toFile: filePath,
    progress: res => {
        console.log((res.bytesWritten / res.contentLength).toFixed(2));
    },
    progressDivider: 1
});
download.promise.then(result => {
    if(result.statusCode == 200){
        NativeModules.InstallApk.install(filePath);
    }
});

Dependents (0)

Package Sidebar

Install

npm i react-native-install-apk

Weekly Downloads

3

Version

1.0.0

License

ISC

Last publish

Collaborators

  • flare216