Naturally Pacifist Marsupials

    react-native-android-update-matt

    1.0.11 • Public • Published

    react-native-android-update-matt

    Getting started

    $ npm install react-native-android-update-matt --save

    Mostly automatic installation

    $ react-native link react-native-android-update-matt

    Manual installation

    Android

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

    Usage

    import AndroidUpdate from 'react-native-android-update-matt';
     
    componentDidMount() {
        this.upgradeTimer = setTimeout(() => {
          let url = x;
          let version = y;
          let options = {token:xxx, dlUrlPrefix:xxx};
          AndroidUpdate.update(url, version, options);
        }, 500);
      }
     
      componentWillUnmount() {
        this.upgradeTimer && clearTimeout(this.upgradeTimer);
      }
    @RequestMapping("/appUpdate")
    public Response appUpdate() {
        Map map = new HashMap();
        map.put("version", "x.x.x");
        map.put("description", new String[] {"xxx","xxx");
        map.put("url", "http://xxx.xxx.xxx.xxx/xx.apk");
        return new Response().success(map);
    } 
     
    Response from server:
    -----
     
    {
      success: true,
      result {
        version: 'x.x.x',
        description: ["xxx","xxx"],
        url: 'http://xxx.xxx.xxx.xxx/xx.apk'
      }
    }
     

    Install

    npm i react-native-android-update-matt

    DownloadsWeekly Downloads

    0

    Version

    1.0.11

    License

    MIT

    Unpacked Size

    504 kB

    Total Files

    47

    Last publish

    Collaborators

    • mattdttam