Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get a versionName in react-native app on Android?

I've made a timestamped versionName in build.gradle like 20150707.1125. I want to show the version of the package in react-native app in about window. How I could get versionName in code?

like image 543
usego Avatar asked Jul 07 '16 08:07

usego


People also ask

How do I change the code in React Native app?

to update the version code and name change in android/app/build. gradle : android { defaultConfig { versionCode 1 versionName "1.0" {...} }

How do I force update an app React Native?

You can use https://appupgrade.dev/ service to force update you mobile apps. You need to create new version for your app versions you want to update in the app upgrade service and select whether you want to force it or just want to let users know that new version is available.


1 Answers

I've successfully used the React Native Device Info component to get the build details as specified in the Gradle config.

Once installed you can use:

DeviceInfo.getVersion() 

To output the version, and:

DeviceInfo.getBuildNumber() 

To get the build number.

like image 128
Tom Walters Avatar answered Sep 18 '22 21:09

Tom Walters