---
# System prepended metadata

title: '"Final steps", min app version - Mon, Tues 16th-17th Nov, 2020'
tags: [firebase, C+, finalsteps, programmingjournal, proguard, hermes, remoteconfig, '2020', minversion]

---

# "Final steps", min app version - Mon, Tues 16th-17th Nov, 2020

I followed the excellent [React Native final steps checklist](https://shift.infinite.red/react-native-final-steps-691a01f9d895). 

Every step was fine, including [enabling Hermes](https://reactnative.dev/docs/hermes) for Android and [handling fatal JS and native crashes](https://github.com/a7ul/react-native-exception-handler).

The only issue was enabling ProGuard. The app would always crash on startup. Checking logcat logs, I believe [this was the fundamental issue](https://github.com/facebook/react-native/issues/25537).

I also added a minimum version support for the app. The idea is that if there is an app version we absolutely don't want users to be on anymore (for example: a security issue), we can bump this minimum version number, which if their app version is lower than will block them from using the app and force them to upgrade.

This is really easy to do with Firebase's [Remote Config](https://firebase.google.com/docs/remote-config).

Once this `min_version` value is set in Firebase, it's easy to handle in app:

```typescript=
useEffect(() => {
    remoteConfig()
    // methods from react-native-firebase
        .fetchAndActivate()
        .then(() => {
            const minVersion = remoteConfig().getValue('min_version_number').asString()
            const currentVersion = getVersion()
            // compare app version with min version
            const isOk = compareVersions.compare(minVersion, currentVersion, '<=')
            // minVersion <= currentVersion
            if (isOk) {
                setIsMinVersion('ok')
            } else if (!isOk) {
                setIsMinVersion('requiresUpdate')
            }
        })
        .catch((error) => {
            // eslint-disable-next-line no-console
            console.warn('Error fetching min version: ', error)
            crashlytics().recordError(error)
            setIsMinVersion('ok') // allow user to continue if minVersion cannot be retrieved
        })
}, [])
```

###### tags: `programmingjournal` `2020` `C+` `firebase` `minversion` `remoteconfig` `hermes` `finalsteps` `proguard`