Can you use a single vector image as an adaptive icon for Android with Cordova?

Viewed 127

I have an Android app built with Cordova natively which previously used PNG images for icons which we are attempting to convert to an adaptive icon. Full disclosure - I rarely if ever use Android Studio but can and will as needed. The docs for Cordova (https://cordova.apache.org/docs/en/latest/config_ref/images.html#android) show referencing multiple image files for adaptive icons:

<platform name="android">
  <icon background="res/icon/android/ldpi-background.xml" density="ldpi" foreground="res/icon/android/ldpi-foreground.xml" src="res/android/ldpi.png" />
  <icon background="res/icon/android/mdpi-background.xml" density="mdpi" foreground="res/icon/android/mdpi-foreground.xml" src="res/android/mdpi.png" />
  <icon background="res/icon/android/hdpi-background.xml" density="hdpi" foreground="res/icon/android/hdpi-foreground.xml" src="res/android/hdpi.png" />
  <icon background="res/icon/android/xhdpi-background.xml" density="xhdpi" foreground="res/icon/android/xhdpi-foreground.xml" src="res/android/xhdpi.png" />
  <icon background="res/icon/android/xxhdpi-background.xml" density="xxhdpi" foreground="res/icon/android/xxhdpi-foreground.xml" src="res/android/xxhdpi.png" />
  <icon background="res/icon/android/xxxhdpi-background.xml" density="xxxhdpi" foreground="res/icon/android/xxxhdpi-foreground.xml" src="res/android/xxxhdpi.png" />
</platform>

I know Android wants a "vector drawable" image which is similar to an SVG and I can convert an SVG to that format. However, the docs for Android (https://developer.android.com/guide/practices/ui_guidelines/icon_design_adaptive) seem to call for a single vector image at 108dp x 108dp. I am not exactly sure what "dp" means but I assume it is a relative coordinate system for the vector.

What confuses me is that Android docs call for a single vector at 108dp x 108dp but the Cordova docs show linking 6 individual XML files (vector drawable images). Why would you need 6 different vector images? Doesn't that defeat the purpose? Can someone who has made this work clarify what is expected of these 6 different image files in Cordova for Andoid? Thanks!

0 Answers
Related