Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@isudaji/react-native-install-apk

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isudaji/react-native-install-apk

install .apk file (android only)

  • 1.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
decreased by-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-install-apk(android only)

npm NPM downloads

init

your-app-name

install

npm i @isudaji/react-native-install-apk --save

OR

yarn add @isudaji/react-native-install-apk

AND

react-native link @isudaji/react-native-install-apk react-native <= 0.60.4

Manual installation

Android
  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add import com.apk.install.RNSdkInstallPackage; to the imports at the top of the file
  • Add new RNSdkInstallPackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
    include ':react-native-install-apk'
    project(':react-native-install-apk').projectDir = new File(rootProject.projectDir,   '../node_modules/react-native-install-apk/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      implementation project(':react-native-install-apk')
    

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);
    }
});

publish

npm publish --access public

Report Bug

  • Invariant Violation: requireNativeComponent: "RNSScreen" was not found in the UIManager.

  • Could not find method compile() for arguments [project ':@isudaji/react-native-install-apk'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • The project name '@isudaji/react-native-install-apk' must not contain any of the following characters: [/, \, :, <, >, ", ?, *, |]

  • Could not find method compile() for arguments [project ':react-native-install-apk'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

  • Could not find method compile() for arguments [com.facebook.react:react-native:+] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler. gradle 3.x

Keywords

FAQs

Package last updated on 21 Feb 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc