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.
-
startUpdateFlow
Basic implementation. - Implement event emitter for flexible in-app updates download progress and downloaded status.
- Implement
clientVersionStalenessDays
check forstartUpdateFlow
.
- 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.
$ 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.
$ react-native link @gurukumparan/react-native-android-inapp-updates
import {startUpdateFlow} from '@gurukumparan/react-native-android-inapp-updates';
const updateModes = 'flexible';
try {
const result = await startUpdateFlow(updateModes);
} catch (e) {
console.log('error:', e);
}
promise string startUpdateFlow(appUpdateType,clientVersionStalenessDays)
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 |
Value | Description |
---|---|
Canceled |
In-app modal canceled by user |
Successful |
User press the update button |
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. |
promise string checkUpdateAvailability()
Value | Description |
---|---|
Update available |
Application update is available |
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 |
promise string onCompleteUpdate()
Value | Description |
---|---|
success |
Application update succeed |
Value | Description |
---|---|
Download is not completed |
Application update process fail |
❤️ From Indonesia