Instructor: First, let's create a basic empty Android project in Android Studio. We're only going to use this to generate our icon. The name and company domain can be anything. Again, we will not be using this project to build our application, just generate our icons. Then click next.
Make sure the phone and tablet option is checked, and API 26 or higher is chosen. Clicking next again, select add new activity, then click finish. Android Studio will generate our application for us. Once it is done, select project view, command one.
Toggle open the app folder, then right click on the Rest folder, and select new image asset. This is going to bring up the image asset tool, which is what we really need. We want our icon type to be a launcher type, adaptive and legacy. Leave the name as-is.
Now, we can design the foreground and background elements of our icon. I'm going to add a new foreground image. I'm going to select my SVG assets, and we can see it applied to the preview pane on the right.
Next, I'm going to switch to the background layer. Again, I'm going to select an SVG to use, but I could have selected the color option instead. When you're satisfied playing around, go ahead and click next. We can see the various elements and directories that will be generated for us. Go ahead and click finish.
The required elements are now in the res directory. Right click again to reveal them on your computer. Select all the items within that folder, and copy them into the Android directory of the resources directory of our Ionic application.
Now, we need to adjust the config.xml file to use these icons. Because we're going to override the Android manifest, we first need to include the Android namespace in the widget tag, like this. Otherwise, Cordova will not understand how to properly merge our changes with the Android manifest file.
Next, let's delete the built-in icon references that the stock config.xml file has for us. Now, we will add an edit config node, and tell it that we want to modify the Android manifest file, and that we're changing the application icon.
Next, we want to include resource file notes. These notes describe all the various screen densities and their icons we'll match to. There are quite a few, so I'm just going to paste them in. The sample file can be downloaded, so you don't even have to attempt to type all this out yourself.
Saving this file, we can run Ionic Cordova build Android from the terminal. Once it is done, we can install it on our phone, and see that we have a nice, proper, little, clear icon.