generateShortcutsXml static method
Implementation
static void generateShortcutsXml(List<Shortcut> shortcuts) {
String xmlContent = """<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android" >
""";
for (final shortcut in shortcuts) {
xmlContent += """
<shortcut
android:enabled="true"
android:icon="${shortcut.icon}"
android:shortcutId="${shortcut.shortcutId}"
android:shortcutShortLabel="${shortcut.shortcutLabel}">
<intent
android:action="android.intent.action.VIEW"
android:targetClass="${shortcut.targetClass}"
android:targetPackage="${shortcut.targetPackage}"
android:data="${shortcut.data}"/>
</shortcut>
""";
}
xmlContent += "</shortcuts>";
String filePath = "android/app/src/main/res/xml-v25/shortcuts.xml";
FileCreator.openFile(filePath).writeAsStringSync(xmlContent);
}