GitHub user veronicatc added a comment to the discussion: Make splash screen icon show when opening the app from deep link by including item in themes.xml
I could achieve this using an after_prepare script. 1) Make sure these are present at the <widget> tag at config.xml: `xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"` 2) Add hook inside android platform section: `<hook src="scripts/after_prepare_theme.js" type="after_prepare" />` 3) This is the content of after_prepare_theme.js: `#!/usr/bin/env node // This hook adds a row to themes.xml after it has been dynamically created, to show splash screen icon when app is opened from deep links var fileToReplace = "platforms/android/app/src/main/res/values/themes.xml"; var fs = require('fs'); var path = require('path'); function replace_string_in_file(filename, to_replace, replace_with) { var data = fs.readFileSync(filename, 'utf8'); var result = data.replace(new RegExp(to_replace, "g"), replace_with); fs.writeFileSync(filename, result, 'utf8'); var data2 = fs.readFileSync(filename, 'utf8'); console.log(data2); } module.exports = function(context) { // var rootdir = process.argv[2]; // old cordova version var rootdir = context.opts.projectRoot; var fullfilename = path.join(rootdir, fileToReplace); if (fs.existsSync(fullfilename)) { replace_string_in_file(fullfilename, "</style>", '<item name="android:windowSplashScreenBehavior" tools:targetApi="33">icon_preferred</item></style>'); } }` Tested on a device with Android 13 and on an emulator with Android 12. On Android 12 it didn't show the icon, as expected, but didn't throw errors either. Since I need this mostly for devices with Android 13 and after, this is ok for me. GitHub link: https://github.com/apache/cordova/discussions/535#discussioncomment-12794683 ---- This is an automatically sent email for issues@cordova.apache.org. To unsubscribe, please send an email to: issues-unsubscr...@cordova.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org