In-app update for Flutter 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.
- Before you begin, make sure that Apptics is integrated into your project by following the Integration Guide.
Show the app update popup
- Call the method checkAndUpdateAlert to check for updates and to show the update popup.
Copiedimport 'package:apptics_flutter/appupdate/apptics_in_app_update.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// Call the method checkAndUpdateAlert to check for updates and to show the update popup.
AppticsInAppUpdates.instance.checkAndUpdateAlert(context);
// return your widget;
}
}
Note:
- The above-mentioned method should be invoked after setting the theme and creating the navigator in the app.
- Flutter in-app updates do not support Material3.
Build the app update flow
- The below method will return a Map<string, dynamic?>, that allows to obtain the data for the popup UI.
- With the data, you can build your own custom app update popup.
Copiedimport 'package:apptics_flutter/appupdate/apptics_in_app_update.dart';
AppticsInAppUpdates.instance.getInAppUpdateData();
- The above method will return a NULL if there is no update available.
- The response type is based on the category string number such as:
- 1 is normal update data.
- 2 is non-supported OS data.
- Extract the key-value pairs listed below to create your custom UI.
- The different action methods are onClickUpdate, onClickReminder, onClickIgnore, onClickNonSupportAlert, and onSendImpressionStatus.
- Use the below to construct the custom popup.
CopiedFor Custom Alerts data (Normal update):
'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: Apptics native UI alert
1: Apptics custom UI alert
2: Android in-app updates
'customStoreUrl': You can redirect this URL to another store.
For the Non-Supported OS popup data:
'title': The title of the popup.
'description': The description of the popup.
'continueBtTxt': Button text for the popup.
'alertType' in the Non-Supported OS popup determines the action:
0: Do Nothing
1: Install Later
2: Freeze
'updateid': The ID corresponding to a specific update configuration.
Show full
Show less