Giter Site home page Giter Site logo

reactnativ / react-native-update-apk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mikehardy/react-native-update-apk

0.0 0.0 0.0 1.93 MB

Update apk from non-play store servers, and update ios from app store in React Native.

License: MIT License

Shell 4.87% JavaScript 26.74% Ruby 3.16% C++ 11.52% Objective-C 6.05% Java 39.25% Objective-C++ 7.02% CMake 0.43% Starlark 0.95%

react-native-update-apk's Introduction

React Native Update APK

npm version npm total downloads npm monthly downloads npm weekly downloads

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

react-native-update-apk's People

Contributors

mikehardy avatar parryworld avatar dependabot[bot] avatar rejunges avatar ismaeldcom avatar gstcyr avatar jeremyzheng avatar nuks avatar cenkakin avatar gaodeng avatar zhpeng8775 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.