# react-native-xupdate

> ## Getting started

Latest version **1.0.3** (published 2019-08-22) · 0 weekly downloads

## Install

```sh
npm install react-native-xupdate
pnpm add react-native-xupdate
yarn add react-native-xupdate
bun add react-native-xupdate
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2019-08-22 |
| First published | 2019-07-06 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 537.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | dougao |
| Keywords | react-native |

## Links

- npm: https://www.npmjs.com/package/react-native-xupdate
- npm.io page: https://npm.io/package/react-native-xupdate

## Recent versions

- 1.0.3 (latest) — 2019-08-22
- 1.0.1 — 2019-07-10
- 1.0.0 — 2019-07-06

## README

# react-native-xupdate

## Getting started

`$ npm install react-native-xupdate --save`

### Mostly automatic installation

`$ react-native link react-native-xupdate`

### Manual installation


#### Android

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


## Usage
```javascript
import RNXupdate from 'react-native-xupdate';

RNXupdate;
```

在MainApplication 的onCreate方法中初始化xupdate:
```
RNXupdateModule.initUpdate(this,getPackageName(), this);
```

使用时:
```
RNXupdate.update(jsonUrl);
json={
    "Code": 0,
  "Msg": "",
  "UpdateStatus": 2,
  "VersionCode": 4,
  "VersionName": "1.0.1",
  "ModifyContent": "新版本发布。",
  "DownloadUrl": "xxx",
  "ApkSize": 8408,// MB
  "ApkMd5": "xxx"
}
```

---
_Source: https://npm.io/package/react-native-xupdate · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
