Socket
Socket
Sign inDemoInstall

jg-react-native-android-auto-update

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    jg-react-native-android-auto-update

React Native Android 应用自动更新


Version published
Maintainers
1
Install size
5.11 MB
Created

Readme

Source

React Native Auto Update For Android In Notification

React Native Android自动下载更新APK,进度条在通知栏中显示

Getting Started npm version

$ npm install git+http://git@github.com/React-Sextant/react-native-android-auto-update.git

$ react-native link react-native-android-auto-update

v0.1.0 usage

README_old.md

v2.3.0 usage

👉全部的UpdateAppUtils Api说明

import {UpdateApp,UiType} from 'react-native-android-auto-update'

UpdateApp({
  apkUrl:"http://.example.com/demo.apk",
  updateTitle:"发现新版本V2.3.0",
  updateContent:"1、Kotlin重构版\n2、支持自定义UI\n3、增加md5校验\n4、更多功能等你探索",
  force:true,
  uiType:UiType.PLENTIFUL,
  titleTextColor:"red",
  UpdateDownloadListener:(type,msg)=>{
    //@param type: onStart | onDownload | onFinish | onError
    if(type === "onDownload"){
       console.log(msg);   // progress
    }else if(type === "onError"){
       alert(msg);         // error message
    }
  },
  OnBtnClickListener:(type)=>{
    console.log(type);     // onCancelBtnClick, onUpdateBtnClick
    return false;          // 事件是否消费,是否需要传递下去。false-会执行原有点击逻辑,true-只执行本次设置的点击逻辑
  }
});

v2.4.0 usage

  • 完善uiType类型UiType.CUSTOM

    • 如果使用UiType.CUSTOM类型,本库custom ui不能通过RN生成,只能自定义XML实现,
    • 所以默认为对Android有一定基础,没有的话也可以借此机会学习😊,不过本库已为您创建了一个custom xml
    • 如果需要定制化,在本地根android项目中创建一个名为view_update_dialog_custom.xml的Layout文件即可覆盖
    • 文件路径:android / app / src / main / res / layout / view_update_dialog_custom.xml

view_update_dialog_custom.xml元素ID必须按照以下命名

<!--更新标题-->
<TextView android:id="@+id/tv_update_title" />
<!--更新内容-->
<TextView android:id="@+id/tv_update_content" />

<!--apk版本名-->
<TextView android:id="@+id/tv_version_name" />
<!--apk版本号-->
<TextView android:id="@+id/tv_version_code" />

<!--更新按钮文案-->
<TextView android:id="@+id/btn_update_sure" />
<!--取消按钮文案-->
<Button android:id="@+id/btn_update_cancel" />

...

Keywords

FAQs

Last updated on 18 Feb 2023

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