0

Is there a way to check if a user has updated version of the app or it is the first version installed? When opening the first screen I would like to know if the user had some previous versions of the app so I can show some message about what is new in the updated version of the app, but only for the old users and not for the new ones. Thanks.

Edit:

I'm working on react-native app, but would like to know if there is a way whether in react-native or android and iOS.

cinemanja
  • 481
  • 6
  • 19

1 Answers1

0

You can check that by checking the version name

private String getCurrentVersion(){
PackageManager pm = this.getPackageManager();
PackageInfo pInfo = null;

    try {
        pInfo =  pm.getPackageInfo(this.getPackageName(),0);

    } catch (PackageManager.NameNotFoundException e1) {
        e1.printStackTrace();
    }
    String currentVersion = pInfo.versionName;

    return currentVersion;
}

for more reference : Android In-app version check

Djaf
  • 256
  • 1
  • 6
  • Not sure if this will help me. I don't need to know if the user has current version of the app and check it with the live one. I need different thing. When user has the latest version of the app I need to know whether that is updated app or it was fresh and first installation. – cinemanja Oct 09 '19 at 12:28
  • 1
    Then this is a solution for you using sharedprefs https://stackoverflow.com/questions/26352881/detect-if-new-install-or-updated-version-android-app – Djaf Oct 09 '19 at 12:32
  • For iOS refer this: https://stackoverflow.com/questions/22118943/how-to-detect-an-ios-app-installed-or-upgraded – udbhateja Oct 09 '19 at 12:54