Socket
Socket
Sign inDemoInstall

@zt-mobile/react-native-android-apk-installer

Package Overview
Dependencies
2
Maintainers
2
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zt-mobile/react-native-android-apk-installer

React Native Android APK Installer with success/error handler


Version published
Maintainers
2
Created

Readme

Source

react-native-android-apk-installer

Getting started

$ npm install react-native-android-apk-installer --save

Mostly automatic installation

$ react-native link react-native-android-apk-installer

Usage

Android APK installer that handles user's interaction on installation dialog.

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

import RNFS from 'react-native-fs'
import AndroidApkInstaller from 'react-native-android-apk-installer';

const filePath = RNFS.DocumentDirectoryPath + '/com.domain.example.apk';
const 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){
        AndroidApkInstaller.install(filePath).then(data => {
            console.log("Installation success")
        })
        .catch(error => {
            console.log("Fail to install")
        })
    }
});

Keywords

FAQs

Last updated on 01 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc