Giter VIP home page Giter VIP logo

react-native-update-apk's Introduction

React Native Update APK

Fork from https://github.com/mikehardy/react-native-update-apk

安装

yarn add https://github.com/qiqiangwu/react-native-update-apk.git
yarn add react-native-fs

安卓需要手动处理

  1. FileProviders

AndroidManifest.xml application 节点下添加

<!-- Define a FileProvider for API24+ -->
<!-- note this is the authority name used by other modules like rn-fetch-blob, easy to have conflicts -->
<provider
  android:name="androidx.core.content.FileProvider"
  android:authorities="${applicationId}.provider"
  android:exported="false"
  android:grantUriPermissions="true">
  <!-- you might need the tools:replace thing to workaround rn-fetch-blob or other definitions of provider -->
  <!-- just make sure if you "replace" here that you include all the paths you are replacing *plus* the cache path we use -->
  <meta-data tools:replace="android:resource"
    android:name="android.support.FILE_PROVIDER_PATHS"
    android:resource="@xml/filepaths" />
</provider>

res/xml/filepaths.xml

<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
  <!-- Select one of the following based on your apk location -->

  <!-- cache dir is always available and requires no permissions, but space may be limited -->
  <cache-path name="cache" path="/" />
  <!-- <files-path name="name" path="/" />  -->

  <!-- External cache dir is maybe user-friendly for downloaded APKs, but you must be careful. -->
  <!-- 1) in API <19 (KitKat) this requires WRITE_EXTERNAL_STORAGE permission. >=19, no permission -->
  <!-- 2) this directory may not be available, check Environment.isExternalStorageEmulated(file) to see -->
  <!-- 3) there may be no beneifit versus cache-path if external storage is emulated. Check Environment.isExternalStorageEmulated(File) to verify -->
  <!-- 4) the path will change for each app 'com.example' must be replaced by your application package -->
  <!-- <external-cache-path name="external-cache" path="/data/user/0/com.example/cache" /> -->

  <!-- Note that these external paths require WRITE_EXTERNAL_STORAGE permission -->
  <!-- <external-path name="some_external_path" path="put-your-specific-external-path-here" />  -->
  <!-- <external-files-path name="external-files" path="/data/user/0/com.example/cache" />  -->
  <!-- <external-media-path name="external-media" path="put-your-path-to-media-here" />  -->
</paths>

  1. 添加权限
<!-- use permission REQUEST_INSTALL_PACKAGES for target API25+ -->
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>

Tasks

  • android 更新对接蒲公英分发平台
  • 下载进度条 UI 采用原生布局
  • 下载确认框采用原生布局
  • 更新托底方案

react-native-update-apk's People

Contributors

cenkakin avatar dependabot[bot] avatar gaodeng avatar gstcyr avatar ismaeldcom avatar jeremyzheng avatar mikehardy avatar nuks avatar parryworld avatar qiqiangwu avatar rejunges 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.