A native app can receive live updates based on the native app version. One way that this can be done is by using the native versioning feature of web builds as discussed in this article. It is also possible to use channels to restrict live updates based on the native app version. This can be done by creating versioned channels that correspond to each native version of your App as shown below:
Different iterations of the native app can then be created where each iteration references their corresponding live update channel.
Managing channels using the CLI
This can be done by using the ionic deploy command in your project with the “channel-name” flag containing the appropriate versioned channel.
If the command is executed correctly, the channel name should appear in the ./ios/App/App/Info.plist for iOS builds:
And in the ./android/app/src/main/res/values/strings.xml for Android builds:
Managing channels using Native Configs
Rather than hardcoding the live update channel configuration in your repository, you can use native configs to dynamically assign the live update destination at build time. This will override the value set in your strings.xml and Info.plist files.
Benefits of using versioned live update channels
- It is easier to track the web builds associated with a specific native version using versioned channels
- The destination page shows a list of channels associated with an app. Clicking on a channel will show a list of all web builds deployed as live updates for this channel.
- So it is easier to visualize which web builds are associated with a specific native app using this method over using the native versioning feature of web builds. With native versioning, the versions associated with a web build can only be viewed from the native versioning tab of a build.
- It is simpler to associate a web build with a native version
- To utilize native versioning, all web builds that need to be deployed as live updates will also need to be assigned their compatible native versions. So it is required to complete this assignment after each web build is created when using native versioning. Meanwhile, web builds that are restricted using versioned channels are expected to work for the native version associated with that channel. So a web build can be associated with a native version even during the creation of the build by specifying the appropriate channel.
- It is easier to avoid accidentally deploying a live update to the wrong app versions
- When using native versioning, Appflow will assume that a web build can be pushed to all versions of the native app if compatible native versions are not specified. Since assigning compatible native versions for every web build can be tedious, it is easy to neglect to specify the compatible native versions for a web build before assigning a live update channel to the build. With versioned channels, it is immediately clear that the web build has been associated with the correct native app version.