In-app update for React Native apps
In-app update module is used to show new version available alerts in your app as per the configuration done in the Apptics web console. Refer to the User Guide to do the configuration in the web console.
Show the app update popup
- Use the below snippet to check for updates and to show the update popup.
Copiedimport { Apptics, AppticsAppUpdate } from '@zoho_apptics/apptics-react-native';
AppticsAppUpdate.showVersionAlertPopup()
- Make sure to call Apptics.init before calling showVersionAlertPopup.
- Add the below colors to your app theme in the main/res/values/styles.xml.
Copied<item name="appticsTextColor">#000000</item>
<item name="appticsSecondaryTextColor">#000000</item>
<item name="appticsUpdateActionButtonColor">#FF00FF</item>
<item name="appticsUpdateActionButtonTextColor">#000000</item>
<item name="appticsRemindAndIgnoreActionButtonColor">#FF00FF</item>
Build the app update flow
- Use checkForUpdate method to obtain a map of data as configured in the web console.
- With the data, you can build your own custom app update popup.
Copiedimport { Apptics, AppticsAppUpdate } from '@zoho_apptics/apptics-react-native';
AppticsAppUpdate.checkForUpdate()
- The above method will return a NULL if there is no update available.
- Use the below to construct the custom popup.
Copied 'updateid': The ID corresponding to a specific update configuration.
'currentversion': The version of the app installed on the device.
'featureTitle': The title or heading for the version alert.
'features': Update features or what's new.
'remindMeLaterText': Localized text for the "Remind Me Later" action.
'updateNowText': Localized text for the "Update" action.
'neverAgainText': Localized text for the "Ignore" action.
The 'option' key determines the type of UI selected for this update in the web console:
option (1): Flexible update flow.
option (2): Immediate update flow.
option (3): Force update flow.
Read More https://www.zoho.com/apptics/resources/user-guide/in-app-updates.html
'reminderDays': The number of days before showing the popup again if the user chooses "Remind Me Later." These days can be configured from the web console.
'forceInDays': A custom store URL to redirect when the user taps "Update/Download." This can also be configured from the web console.
'alertType': The type of the alert - Android in-app updates / ZAnalytics:
0: ZAnalytics custom UI alert
1: ZAnalytics native UI alert
2: Android in-app updates
'customStoreUrl': You can redirect this URL to another store.
- Send action from your custom built pop-up for Apptics to show the stats.
Copiedimport { Apptics, AppticsAppUpdate } from '@zoho_apptics/apptics-react-native';
// update id, fetched from map returned by checkForUpdate
// actions are defined in UpdateStats Enum
AppticsAppUpdate.sendUpdateStat(update_id, UpdateStats.Impression)