Coder Social home page Coder Social logo

sudoplz / sp-react-native-in-app-updates Goto Github PK

View Code? Open in Web Editor NEW
434.0 6.0 59.0 3.11 MB

An in-app updater for the native version of your react-native app.

License: MIT License

Java 25.31% JavaScript 2.28% Shell 0.91% TypeScript 54.44% Ruby 4.38% Objective-C 5.11% Objective-C++ 1.81% Kotlin 5.76%

sp-react-native-in-app-updates's Introduction

sp-react-native-in-app-updates

In app update example

Getting started


What is this?

This is a react-native native module that works on both iOS and Android, and checks the stores (play/app) for a new version of your app and can prompt your user for an update.

It uses embedded in-app-updates via Play-Core on Android (to check & download google play patches natively from within the app), and react-native-siren on iOS (to check & navigate the user to the AppStore).

Why?

Because to this day I'm not aware of any react-native libraries that use play core to offer embedded in-app-updates besides this one


Installation

$ npm install sp-react-native-in-app-updates --save


iOS only:

On React Native iOS you may need to also add the following lines in your Info.plist to be able to launch the store deep link.

<key>LSApplicationQueriesSchemes</key>
<array>
  <string>itms-apps</string>
</array>

For Expo Apps Add the following to your expo app.json or app.config.json .

"ios": {
      "infoPlist": {
        "LSApplicationQueriesSchemes": ["itms-apps"]
      }
    },

Next, rebuild the native files using npx expo prebuild --clean && eas build -p ios


Note:

This project uses react-native-device-info in the background. Install it to ensure everything works correctly.

Expo:

In order to make it work using Expo you need to replace react-native-device-info dependency.

  1. Create react-native-device-info.js file in root with following content. Requires expo-constants dependency. If you target iOS then you also need to ensure you add a bundleIdentifier to the ios section of your expo config.
import Constants from "expo-constants"

export const getBundleId = () => {
    return Constants.expoConfig?.ios?.bundleIdentifier ?? '';
}
export const getVersion = () => {
    return Constants.expoConfig?.version
}
export default {
    getBundleId,
    getVersion,
};
  1. Add alias to module-resolver configuration in babel.config.js
plugins: [
  [
    'module-resolver',
    {
      root: ['.'],
      alias: {
        'react-native-device-info': './react-native-device-info.js'
      }
    }
  ],
  ...
]

Usage

import SpInAppUpdates, {
  NeedsUpdateResponse,
  IAUUpdateKind,
  StartUpdateOptions,
} from 'sp-react-native-in-app-updates';

const inAppUpdates = new SpInAppUpdates(
  false // isDebug
);
// curVersion is optional if you don't provide it will automatically take from the app using react-native-device-info
inAppUpdates.checkNeedsUpdate({ curVersion: '0.0.8' }).then((result) => {
  if (result.shouldUpdate) {
    let updateOptions: StartUpdateOptions = {};
    if (Platform.OS === 'android') {
      // android only, on iOS the user will be promped to go to your app store page
      updateOptions = {
        updateType: IAUUpdateKind.FLEXIBLE,
      };
    }
    inAppUpdates.startUpdate(updateOptions); // https://github.com/SudoPlz/sp-react-native-in-app-updates/blob/master/src/types.ts#L78
  }
});

Usage with app updates for specific country (iOS only)

//                              👇🏻 (optional)
inAppUpdates.checkNeedsUpdate({ country: 'it' }).then(result => {
  if (result.shouldUpdate) {
    const updateOptions: StartUpdateOptions = Platform.select({
      ios: {
        title: 'Update available',
        message: "There is a new version of the app available on the App Store, do you want to update it?",
        buttonUpgradeText: 'Update',
        buttonCancelText: 'Cancel',
        country: 'it', // 👈🏻 the country code for the specific version to lookup for (optional)
      },
      android: {
        updateType: IAUUpdateKind.IMMEDIATE,
      },
    });
    inAppUpdates.startUpdate(updateOptions);
  }
});


Methods:


checkNeedsUpdate(checkOptions: CheckOptions) : Promise<NeedsUpdateResponse>

Checks if there are any updates available.

Where: CheckOptions

Options Type Description
curVersion (required) String The semver of your current app version
toSemverConverter (optional) Function This will run right after the store version is fetched in case you want to change it before it's compared as a semver
customVersionComparator (optional) Function By default this library uses semver behind the scenes to compare the store version with the curVersion value, but you can pass your own version comparator if you want to
country (iOS only) (optional) String default undefined, it will filter by country code while requesting an update, The value should be ISO 3166-1 country code

and NeedsUpdateResponse:

Result Type Description
shouldUpdate Boolean Whether there's a newer version on the store or not
storeVersion String The latest app/play store version we're aware of
other Object Other info returned from the store (differs on Android/iOS)

startUpdate(updateOptions: StartUpdateOptions) : Promise

Shows pop-up asking user if they want to update, giving them the option to download said update.

Where: StartUpdateOptions

Option Type Description
updateType (Android ONLY) (required on Android) IAUUpdateKind Either IAUUpdateKind.FLEXIBLE or IAUUpdateKind.IMMEDIATE. This uses play-core below the hood, read more here about the two modes.
title (iOS only) (optional) String The title of the alert prompt when there's a new version. (default: Update Available)
message (iOS only) (optional) String The content of the alert prompt when there's a new version (default: There is an updated version available on the App Store. Would you like to upgrade?)
buttonUpgradeText (iOS only) (optional) String The text of the confirmation button on the alert prompt (default: Upgrade )
buttonCancelText (iOS only) (optional) String The text of the cancelation button on the alert prompt (default: Cancel)
forceUpgrade (iOS only) (optional) Boolean If set to true the user won't be able to cancel the upgrade (default: false)
bundleId (iOS only) (optional) String The id that identifies the app (ex: com.apple.mobilesafari). If undefined, it will be retrieved with react-native-device-info. (default: undefined)
country (iOS only) (optional) String If set, it will filter by country code while requesting an update, The value should be ISO 3166-1 country code (default: undefined)
versionSpecificOptions (iOS only) (optional) Array<IosStartUpdateOptionWithLocalVersion> An array of IosStartUpdateOptionWithLocalVersion that specify rules dynamically based on what version the device is currently running. (default: undefined)

installUpdate() : void (Android only)

Installs a downloaded update.

addStatusUpdateListener(callback: (status: StatusUpdateEvent) : void) : void (Android only)

Adds a listener for tracking the current status of the update download.

Where: StatusUpdateEvent

Option Type Description
status AndroidInstallStatus The status of the installation (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallStatus)
bytesDownloaded int How many bytes were already downloaded
totalBytesToDownload int The total amount of bytes in the update

removeStatusUpdateListener(callback: (status: StatusUpdateEvent) : void): void (Android only)

Removes an existing download status listener.

Example:

Example project

Typical debugging workflow we had success with:

Debugging in-app-updates is tricky, so arm yourself with patience, enable debug logs by passing true to our library constructor. To enable console.log for release you may need react-native log-android or react-native log-ios.

First of all use a REAL device.

Step 1: Enable internal app sharing (google it) on your android device
Step 2: Create a release apk (or aab) with the lower version of your app (i.e version 100)

(you don't like the debug variant right? Neither do we, but we couldn't find an easier way to check that everything's working fine - debug builds don't work with in-app-updates unfortunately)

Step 3: Create a release apk (or aab) with the higher version of your app (i.e version 101)

This is what you'd be updating to

Step 4: Upload both apk's to internal app sharing
Step 5: Install the version 100 on your device.
Step 6: Open the internal app sharing link of version 101 on your device but DON'T install it

Make sure that the button within that link says UPDATE (and NOT install)

That means google play knows there's an available update

Step 7: Open the installed (100) version of the app, and make sure that your code works (that you see an update popup)

Haven't really found any easier ways to test that everything works, but hey.. it get's the job done


Troubleshooting

Keep in mind that this library is JUST a WRAPPER of the in-app-update api, so if you have trouble making in-app-updates work it's most probably because you're doing something wrong with google play.

  • In-app updates works only with devices running Android 5.0 (API level 21) or higher.
  • Testing this won’t work on a debug build. You would need a release build signed with the same key you use to sign your app before uploading to the Play Store (dummy signing can be used). It would be a good time to use the internal testing track.
  • In-app updates are available only to user accounts that own the app. So, make sure the account you’re using has downloaded your app from Google Play at least once before using the account to test in-app updates.
  • Because Google Play can only update an app to a higher version code, make sure the app you are testing as a lower version code than the update version code.
  • Make sure the account is eligible and the Google Play cache is up to date. To do so, while logged into the Google Play Store account on the test device, proceed as follows: Make sure you completely close the Google Play Store App. Open the Google Play Store app and go to the My Apps & Games tab.

Important: If the app you are testing doesn’t appear with an available update, don't bother checking for updates programmatically, because you'll probably never see any available updates via code either.


Contributing:

This library is offered as is, if you'd like to change something please open a PR


Changelog

Read the CHANGELOG.md file

License

MIT

sp-react-native-in-app-updates's People

Contributors

abdollahzadehghalejoghi avatar adityamohta avatar brianlenz avatar chromeq avatar dependabot[bot] avatar gunnarak avatar ikhsanalatsary avatar kamalpandey avatar krisgerhard avatar maslenkov avatar mkauhan avatar se09deluca avatar shivamjoker avatar sudoplz avatar theafolayan avatar woobottle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sp-react-native-in-app-updates's Issues

Not able to open In app update in OnePlus devices. Any Solution for this?

Implementing this library in js file with functional components
What i am doing inside my code is

import SpInAppUpdates, { UPDATE_TYPE } from 'sp-react-native-in-app-updates';
const inAppUpdates = new SpInAppUpdates();

const checkForUpdates = () => {
let currentAppVersion = DeviceInfo.getVersion(); //getting installed app version through this
inAppUpdates
.checkNeedsUpdate({
curVersion: currentAppVersion,
toSemverConverter: ver => {
const androidVersionNo = parseInt(ver, 10);
const majorVer = Math.trunc(androidVersionNo / 10000);
const minorVerStarter = androidVersionNo - majorVer * 10000;
const minorVer = Math.trunc(minorVerStarter / 100);
const patchVersion = Math.trunc(minorVerStarter - minorVer * 100);
return ${majorVer}.${minorVer}.${patchVersion};
},
})
.then(result => {
if (result.shouldUpdate) {
const updateType = UPDATE_TYPE.IMMEDIATE ; //doing this for force update so set it immediate
inAppUpdates.startUpdate({
updateType,
});
}
})
.catch(err => {
console.log('error occurred while in app update', err);
});
};
//JSX part
<CustomButton
style={styles.btnUpdate}
handler={() => checkForUpdates()}
title="InAppUpdate"
/>

Current Behaviour :
MI device : In App update popup apears in app only.( Working as expected)
OnePlus 5 device : Nothing happened after clicking the same button.

Debug the code for onePlus device it is giving me success in promise.But result.shouldupdate is giving false and store version is undefined. Any specific reason for this?

With mi device it is giving me result.shouldupdate is giving true and store version is XXX.XX.49 which is correct.

Let me know if any other configuration or anything required from my side so that it can be workable in oneplus device

If for anyone this library is working for all devices . Please share code .

App Crashes on IMMEDIATE Update

I'm using version: 1.1.1, and updating the app with the type 'Immediate'.

The first flow happens smoothly where it asks the user to update the app, but it keeps on installing until it crashes. When I open the app again it shows as updated.

Here is the update call -
let update_type = { updateType: IAUUpdateKind.IMMEDIATE }; try { let response = await this.inAppUpdates.startUpdate( update_type ) } catch(e) { console.log(e); }

Binder has died

Any idea what this is or how does this happen?

Error: sp-react-native-in-app-updates checkNeedsUpdate error: Error: android.os.RemoteException: AppUpdateService : Binder has died.
  at anonymous(index.android.bundle:4:27)
  at anonymous(index.android.bundle:1:1)
  at res(node_modules/promise/setimmediate/es6-extensions.js:76:16)
  at Promise(node_modules/promise/setimmediate/core.js:56:11)
  at apply(native)
  at <global>(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:212:80)
  at <global>(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:489:3)
  at _callTimer(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:86:3)
  at clearReactNativeMicrotask(node_modules/react-native/Libraries/Core/Timers/JSTimers.js:335:19)
  at MessageQueue(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:241:3)
  at constructor(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:60:19)
  at processCallbacks(node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:224:17)
  at flushedQueue(index.android.bundle:423:3)
  at invokeCallbackAndReturnFlushedQueue(index.android.bundle:390:3)

not working as expected

hi...you have done good work sir....
but can i know if my app which is in app store it's version code is 1 and version name is 1.0 now i want to make update via this beautiful library but when i follow this library method as i have give curversion 0.1 so i can get the update notification but as always i'm getting no need to update....i have tried so many times but i'm not getting success

this.inAppUpdates
.checkNeedsUpdate({
curVersion: '0.1',
})
.then(result => {
console.log('result', result);
if (result.shouldUpdate) {
// this.props.navigation.navigate('Appupdate');
const updateType = UPDATE_TYPE.IMMEDIATE ; //doing this for force update so set it immediate
this.inAppUpdates.startUpdate({
updateType,
});
} else {
alert('we dont need to hmm');
}
}).catch(err => {
console.log('error occurred while in app update', err);
});

Getting warning in play console (Update the Play Core Library in your app to the latest version (1.7.2 or above).)

Critical issues have been reported with the following SDK versions:
com.google.android.play:core:1.7.1
What the SDK developer told us:
Your app contains a vulnerability that can lead to an attacker writing data to your app's internal storage. This is because your app is using an old version of the Play Core Library. Update the Play Core Library in your app to the latest version (1.7.2 or above).

Getting Require cycle warning

Can you please fix this ?

Require cycle: node_modules/sp-react-native-in-app-updates/node_modules/semver/classes/comparator.js -> node_modules/sp-react-native-in-app-updates/node_modules/semver/classes/range.js -> node_modules/sp-react-native-in-app-updates/node_modules/semver/classes/comparator.js

latest version from playstore is not being detected

I used react-native-version-check to check the latest from playstore. It worked there but react-native-in-app-updates is not detecting the latest version. Its giving should update as false. if i directly call the update function it says:

[Error: sp-react-native-in-app-updates startUpdate error: Error: Update unavailable, check checkNeedsUpdate.updateAvailability first]

How can i make it to work

Handling the cross icon press on the initial prompt for immediate update

When startUpdate is called with {updateType: IAUUpdateKind.IMMEDIATE}, the promise gets resolved and a prompt is opened. If the user cancels the update in this stage by pressing the cross icon (circled in the screenshot), there seems to be no way to handle that because startUpdate's promise has already been fulfilled by that point, and addStatusUpdateListener's callback is not triggered until the user confirms the update. You're left in a kind of suspended position where you can only tell if the update is eventually accepted (via addStatusUpdateListener) but can't register if the cross button has ever been pressed.

I realize this might not be the problem with the library itself as i couldn't find any native solutions to this either, but maybe there's something i'm missing? For my use case (terminating if the user refuses or an error occurs) just quitting the app via react-native-exit-app after startUpdate seems to work, because when the update completes successfully you'd want to restart anyway, but this is very sloppy and i'd like to do this "properly".

immediate_upd

Not working

Was working properly a day before, but now not working

Testing library on emulator or TestFlight

In a documentation I see that the library make a decision about update availability depends on application version in the AppStore. Are there any ways to test this react-native-in-app-updates via TestFlight or even iOS emulator?

error entering into checkNeedsUpdate function

When I click on the button to update it issues an error

Error: sp-react-native-in-app-updates checkNeedsUpdate error: Error: com.google.android.play.core.install.InstallException: Install Error(-3): The API is not available on this device.

My app gets closed when the update is installed.

I have followed the documentation and the example provided. My android app can detect the update and It can also download the app and install it. But, after installation my app is closed.
What I want is to reload my app. I don't know if the library is working that way or there is a problem in my case?
I have searched a lot about it. but, the only thing that I found was to define a new native module.

App fails to install in debug mode on android with status code 5

I have face issue for install app

after UPDATE_DOWNLOADED status , I can not install app using inAppUpdates.installUpdate() funcation,
after UPDATE_DOWNLOADED status, visible 3-5 second installation screen then after installation screen invisible &
inAppUpdates.addStatusUpdateListener(listner); return status code 5,
i check in mi device i currently checking in debug mode ,
please give me you positive response

Need more documentation Google Play

Need add to README steps of configuration of google play like

  • add com.google.android.play:core
  • Enffort REAL DEVICE with SAME ACCOUNT EMAIL
  • Have one app on google play with same name of yours and same account
  • Enable Internal app sharing on the google play
  • add Testers email in internal testing
  • call function installUpdate on status 11 of progress

toSemverConverter function not getting called

export const updateApp = () => {
const inAppUpdates = new SpInAppUpdates(
false // isDebug
);
inAppUpdates
.checkNeedsUpdate({
curVersion: "1.0.36",
toSemverConverter: (ver) => {
console.warn("e/.............................", ver);

    return "2";
  },
})
.then((result) => {
  console.warn("result", result);

  if (result.shouldUpdate) {
    let updateOptions: StartUpdateOptions = {};
    if (Platform.OS === "android") {
      // android only, on iOS the user will be promped to go to your app store page
      updateOptions = {
        updateType: IAUUpdateKind.IMMEDIATE,
      };
    }
    inAppUpdates.startUpdate(updateOptions); 
  }
});

};

Result output:
result {"other": {"isFlexibleUpdateAllowed": false, "isImmediateUpdateAllowed": false, "packageName": "com.teachopia.education", "totalBytes": 0, "updateAvailability": 1, "updatePriority": 0, "versionCode": 3145738}, "reason": "status: 1 means there's no new version available", "shouldUpdate": false}

Update com.google.android.play:core

On Play Store i have this message:
Your app contains a vulnerability that can lead to an attacker writing data to your app's internal storage. This is because your app is using an old version of the Play Core Library. Update the Play Core Library in your app to the latest version (1.7.2 or above).

Thanks

In App Updates not Working

This is my code, I used the implementation listed on Readme file. When I run on closed test Alpha at PlayStore it doesn't popup any update component. I don't understand what is wrong.

I implemented also " implementation 'com.google.android.play:core:1.10.0' " on android/app/build.gradle.

APP VERSION CODE BEFORE: 25
APP VERSION NAME BEFORE: 1.8

APP VERSION CODE AFTER: 26
APP VERSION NAME AFTER: 1.9

const App = () => {
  LogBox.ignoreAllLogs();
  const inAppUpdates = new SpInAppUpdates(
    false // isDebug
  );
  // curVersion is optional if you don't provide it will automatically take from the app using rn-device-info

  useEffect(() => {
    inAppUpdates.checkNeedsUpdate().then((result) => {
      if (result.shouldUpdate) {
        let updateOptions = {};
        if (Platform.OS === 'android') {
          // android only, on iOS the user will be promped to go to your app store page
          updateOptions = {
            updateType: IAUUpdateKind.IMMEDIATE,
          };
        }
        inAppUpdates.startUpdate(updateOptions);
      }
    });
  }, []);

  return (
    <Provider store={store}>
      <PersistGate persistor={persistor}>
        <StatusBar
          barStyle="light-content"
          backgroundColor={DARK_ACCENT_GREEN}
        />
        <Routes />
        <FlashMessage position="bottom" />
      </PersistGate>
    </Provider>
  );
};

export default App;

Not getting any event on the click of no thanks button

I tried looking into the documentation and also in code but could not find an event that is produced when no thanks is clicked. Originally the cancel event should trigger but it is triggered on the click of cancel button that appears on the tray.
Please guide as to how to get the event on no thanks.

Error: Can't find variable: customVersionComparator

Hello;

I'm trying to test this library it works fine when i put a versionCode >= to the one in play store. it gives me a response like this :

{
    "other": {
        "isFlexibleUpdateAllowed": false,
        "isImmediateUpdateAllowed": false,
        "packageName": "com.test.test",
        "totalBytes": 0,
        "updateAvailability": 1,
        "versionCode": 3
    },
    "reason": "status: 1 means there's no new version available",
    "shouldUpdate": false
}

But when i but my versionCode < to the one in play store to simulate an outdated version i get this error :
[Error: sp-react-native-in-app-updates checkNeedsUpdate error: ReferenceError: Can't find variable: customVersionComparator]

even though in the README the customVersionComparator is not required.
Am i doing something wrong ? here is how i'm using the lib :

const inAppUpdates = new SpInAppUpdates();

    inAppUpdates
      .checkNeedsUpdate({
        curVersion: '3.0.3',
      })
      .then(result => {
        console.log(result);
        if (result.shouldUpdate) {
          inAppUpdates.startUpdate({
            updateType: SpInAppUpdates.UPDATE_TYPE.FLEXIBLE, // android only, on iOS the user will be promped to go to your app store page
          });
        }
      })
      .catch(error => {
        console.log(error);
      });

And i'm using React-Native Version 0.62.2

Android Device Popup Not showing

Hi , I am using this code And using Internal Test track .but nothing show

const inAppUpdates = new SpInAppUpdates(
false // isDebug
);

// curVersion is optional if you don't provide it will automatically take from the app using react-native-device-info
inAppUpdates.checkNeedsUpdate({ curVersion: DeviceInfo.getVersion()}).then((result) => {
  alert(JSON.stringify(result))
  if (result.shouldUpdate) {
    let updateOptions: StartUpdateOptions = {};
    if (Platform.OS === 'android') {
      // android only, on iOS the user will be promped to go to your app store page
      updateOptions = {
        updateType: IAUUpdateKind.FLEXIBLE,
      };
    }
    inAppUpdates.startUpdate(updateOptions); // https://github.com/SudoPlz/sp-react-native-in-app-updates/blob/master/src/types.ts#L78
  }
});

WhatsApp Image 2022-01-11 at 17 20 14

    inAppUpdates.startUpdate(updateOptions); // https://github.com/SudoPlz/sp-react-native-in-app-updates/blob/master/src/types.ts#L78
  }
});

WhatsApp Image 2022-01-11 at 17 52 02

@SudoPlz Can you Please help it

Not working with Expo

Hi, I am trying to use this in my expo app. I am assuming native linking doesn't work for it right now with expo. I get the following error. Is there any plan to make it work with expo?

inappupdate

Thanks

Install Error(-10): The app is not owned by any user on this device.

Install Error(-10): The app is not owned by any user on this device. An app is "owned" if it has been acquired from Play. (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_APP_NOT_OWNED)
Error: sp-react-native-in-app-updates checkNeedsUpdate error: Error: com.google.android.play.core.install.InstallException: Install Error(-10): The app is not owned by any user on this device. An app is "owned" if it has been acquired from Play. (https://developer.android.com/reference/com/google/android/play/core/install/model/InstallErrorCode#ERROR_APP_NOT_OWNED)

Start Update not working Properly. Always give Status 5 after installing

"sp-react-native-in-app-updates": "^1.1.3"
"react": "17.0.2",
"react-native": "0.66.4"

Issue I am facing in android whenever, I call startUpdate method listenser gives
status 2
status 11
status 3
and finally status 5 (i.e failed)

Please help me why this is happening and provide some solution to avoid this issue.

in app updates not working

i have downgraded my app version and tried implementing
playstore Version 1.0.27
versioncode :31
my bundle version :1.0.26
versionCode:30
when I tried to update
got the below data
{
"other": {
"isFlexibleUpdateAllowed": false,
"isImmediateUpdateAllowed": false,
"packageName": "com.madahead.app",
"status": 0,
"totalBytes": 0,
"updateAvailability": 1,
"updatePriority": 0,
"versionCode": 11
},
"reason": "status: 1 means there's no new version available",
"shouldUpdate": false
}

Couldn't fetch the latest version

Hi, I've tried following example code mentioned in example folder in my project but it doesn't get the latest version from playstore. It always throws error as '"other": {"updateIsAvailable": false}, "reason": "Couldn't fetch the latest version", "shouldUpdate": false}".
In package.json file version is '0.0.1' and android/gradle file I've changed the version as '1.1.5' and Info.plist ios file, I've changed CFBundleShortVersionString as '1.1.5'. Apk latest version is 1.1.7 (available in playstore).

How exactly version check works. ?

Here's the sample code I've tried.

checkForUpdates = async () => {
        try {
            console.log("========== appUpdate", DeviceInfo.getVersion());
            const appUpdate = await this.inAppUpdates
                .checkNeedsUpdate({
                    curVersion: DeviceInfo.getVersion() //'1.1.5'
                });
            console.log("========== appUpdate", appUpdate);
        } catch (error) {
            console.log('========= error =======', error);
        }
    };

Unexpected token

Hello,
on console i have this warning:
Screen Shot 2021-08-25 at 13 46 19

Im using Android device

Due to use of com.google.android.play:core:1.7.1 , google play console showing Critical sdk issue in app

Warning from play console:

Your latest production release (42010506 (1.5.6)) contains SDK issues
Critical issues have been reported with the following SDK versions:

com.google.android.play:core:1.7.1

What the SDK developer told us:
Your app contains a vulnerability that can lead to an attacker writing data to your app's internal storage. This is because your app is using an old version of the Play Core Library. Update the Play Core Library in your app to the latest version (1.7.2 or above).

checkNeedsUpdate not working with iOS apps for limited countries

Hi,
currently the iOS apps limited to certain country are not found by the lookup api of iTunes, because of a country code filter needed that is missing.
I propose to update react-native-siren to the newest version (currently v0.0.5) and adds an optional country param to CheckOptions, than pass down to Siren's performCheck function.

Let me know if you agree..
I can help with a pull request.

Bye 👋🏻

Unable to test iOS app update implementation.

Hi, i am not able to test this implementation in iOS before moving it to production just like you provided internal testing option for android and its working fine for that. So, please suggest me how to test it once before release it out.
Thanks.

in-app-update in not working with enableSeparateBuildPerCPUArchitecture = true

when creating four different apk's with enableSeparateBuildPerCPUArchitecture = true I am getting the response as given below
result {"other": {"isFlexibleUpdateAllowed": false, "isImmediateUpdateAllowed": false, "packageName": "com.teachopia.education", "totalBytes": 0, "updateAvailability": 1, "updatePriority": 0, "versionCode": 3145738}, "reason": "status: 1 means there's no new version available", "shouldUpdate": false}

new NativeEventEmitter()` was called with a non-null argument

after upgrading to RN 0.66 I keep receiving these warnings when app starts:

WARN new NativeEventEmitter() was called with a non-null argument without the required addListener method.
WARN new NativeEventEmitter() was called with a non-null argument without the required removeListeners method.

I don't receive this warning if I comment out codes related to this package

Question about the curVersion

  1. Sorry, i just want to confirm. Is this the version from package.json or the versionName from build.gradle?
  2. I already have an app available live on google playstore, do i need to upload a new apk first with this library installed in order to get an update?

My app's versionName in build.gralde is 3.0 and i just found out about this package which i think is very useful, i use to tell my users about an apk update using CodePush but that's just a message and this library's implementation is amazing. Thanks

image

Update com.google.android.play:core

I have a warning issue when upload in Google Play Store.

Your app contains a vulnerability that can lead to an attacker writing data to your app's internal storage. This is because your app is using an old version of the Play Core Library. Update the Play Core Library in your app to the latest version (1.7.2 or above).

Example to add inappupdatePrriority

Can add some example where exactly we need to add the inappupdatepriority based on react native app. it will be more help full on completing the implementation.

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.