Code Monkey home page Code Monkey logo

react-native-android-inapp-updates's Introduction

react-native-android-inapp-updates

npm PRs Welcome

React Native implementation of the Android In-App Update API. For more information on InApp Updates you can check the official documentation.

Build with ReasonML. This project is still on beta.

Project Milestone

  • startUpdateFlow Basic implementation.
  • Implement event emitter for flexible in-app updates download progress and downloaded status.
  • Implement clientVersionStalenessDays check for startUpdateFlow.

Requirements

  • In-app updates works only with devices running Android 5.0 (API level 21) or higher.
  • In-app updates can only work when signed with the same signing key as your app on the play store.

Getting started

$ npm install @gurukumparan/react-native-android-inapp-updates --save

or

$ yarn add @gurukumparan/react-native-android-inapp-updates

For [email protected] or above

As [email protected] or above supports autolinking, so there is no need to run linking process. Read more about autolinking here.

Mostly automatic installation

$ react-native link @gurukumparan/react-native-android-inapp-updates

Usage

import {startUpdateFlow} from '@gurukumparan/react-native-android-inapp-updates';
const updateModes = 'flexible';

try {
    const result = await startUpdateFlow(updateModes);
} catch (e) {
    console.log('error:', e);
}

Reference

Methods

startUpdateFlow()

promise string startUpdateFlow(appUpdateType,clientVersionStalenessDays)
Input
Input Description Type Default Value
appUpdateType Android In-app updates type enum(flexible or immediate) immediate
clientVersionStalenessDays If an update is available In-app modal will only triger after x number of days since the Google Play Store app on the user's device has learnt about an available update. int 0
Promise Resolve
Value Description
Canceled In-app modal canceled by user
Successful User press the update button
Promise Reject
Value Description
checkAppUpdate failure: appUpdateInfoTask failed getting result. This can mean numerous reason check the log for more explanation.
No update available There is no update available with the appUpdateType type.
startUpdateFlow failure: Failed starting the Google Play In-app updates modal.

checkUpdateAvailability()

promise string checkUpdateAvailability()
Promise Resolve
Value Description
Update available Application update is available
Promise Reject
Value Description
checkAppUpdate failure: appUpdateInfoTask failed getting result. This can mean numerous reason check the log for more explanation.
No update available There is no update available

onCompleteUpdate()

promise string onCompleteUpdate()
Promise Resolve
Value Description
success Application update succeed
Promise Reject
Value Description
Download is not completed Application update process fail

❤️ From Indonesia

react-native-android-inapp-updates's People

Contributors

gedeagas avatar ybbond avatar renopp avatar

Watchers

James Cloos 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.