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

rn-update-apk

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rn-update-apk

Check for new APK versions and update app from React Native

  • 5.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

npm version npm total downloads npm monthly downloads npm weekly downloads

React Native Update APK

Easily check for new APKs and install them in React Native.

Installation

npm install rn-update-apk --save

Manual steps for Android

  1. FileProviders: Android API24+ requires the use of a FileProvider to share "content" (like downloaded APKs) with other applications (like the system installer, to install the APK update). So you must add a FileProvider entry to your AndroidManifest.xml, and it will reference a "filepaths" XML file. Both are demonstrated in the example as linked here.

  2. Permissions For Android 25+ you need to add REQUEST_INSTALL_PACKAGES to your AndroidManifest.xml

Please install and run the example to see how it works before opening issues. Then adapt it into your own app. Getting the versions right is tricky and setting up FileProviders is very easy to do incorrectly, especially if using another module that defines one (like rn-fetch-blob)

Usage

Please see the example App.js as it is very full featured and has very thorough documentation about what each feature is for. You just need to check out the module from github, cd example && npm install && npm start then react-native run-android in another terminal with an emulator up to see everything in action.

Changelog

See the Changelog on github

Testing

This application has been tested on API21+. Older versions of this library also supported API16-20 with HTTPS updates working via a patch to SSL services achieved via Google Play Services. This has been removed now that react-native only supports API21+. Use older versions if you support API16-20.

Version JSON example

Note that you can host tests on dropbox.com using their "shared links", but if you do so will need to put '?raw=1' at the end of the link they give you so you get the raw file contents instead of a non-JSON XML document

// version.json example
// Note you will need to verify SSL works for Android <5 as it has SSL Protocol bugs
// If it doesn't then you may be able to use Google Play Services to patch the SSL Provider, or just serve your updates over HTTP for Android <5
// https://stackoverflow.com/a/36892715
{
  "versionName":"1.0.0",
  "apkUrl":"https://github.com/NewApp.apk",
  "forceUpdate": false,
  "whatsNew": "<< what changes the app update will bring >>"
}

Library Dependency

  • react-native-fs

Keywords

FAQs

Package last updated on 12 Jun 2021

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