Using Appflow's deploy feature involves installing and configuring the cordova-plugin-ionic plugin properly. If you follow the steps given in the Appflow SDK installation guide within a Capacitor application, the plugin will be properly configured. This guide provides some technical details on what the that process accomplishes in case you need to change anything, examine the existing configuration, or convert an application from Cordova to Capacitor.
Running "ionic deploy add" updates two configuration files: android/app/src/main/res/values/strings.xml and ios/App/App/Info.plist. These files are only updated if the platforms have been added to your project. For this reason it is best to add the platforms to the project first, then add the cordova-plugin-ionic plugin afterwards.
The following contents are added to each of these files:
The first three values shown in each file (app id, channel name, and update method) can be added/updated via "ionic deploy configure" if needed. If the last three values are missing, they will need to be added to the appropriate files manually.
Cordova to Capacitor
With a Cordova application, the app id, channel name, and update method are all specified as variables for the plugin. The Cordova build process then updates the native projects as they are generated and prepared.
Capacitor does not have this process since you as a developer are in full control of the native projects, including the files mentioned above. So if you are converting an application from Cordova to Capacitor and already have the deploy plugin installed you will need to manually update the strings.xml and info.plist files.
The easiest process for adding the required items is to uninstall the plugin and then add it again. To do this, run the following commands from the root folder of your application.
$ npm rm cordova-plugin-ionic
$ ionic deploy add
Alternatively, if you want to be a little more "hands on", you can run "ionic deploy configure" and then manually add the parts that are missing. That process looks like this:
- Run "ionic deploy configure" in your application's root folder
- You will be asked for the app id, channel name, and update method
- The Ionic CLI will update the two files for you
- Open the files and add the max versions, min background duration, and update API values as noted above
At this point, your native applications are properly configured for Ionic Appflow's live deploy services. Be sure to commit these changes.
Article is closed for comments.