Make splash screen icon show when opening the app from deep link by including item in themes.xml #535
Replies: 3 comments
-
Should be doable via the config-file directive. Untested example: <widget ... xmlns:android="http://schemas.android.com/apk/res/android">
...
<platform name="android">
...
<config-file target="themes.xml" parent="/resources/style">
<item name="android:windowSplashScreenBehavior">icon_preferred</item>
</config-file>
</platform>
</widget Couple of notes:
Cordova should setup the files on the Because this doesn't describe a bug I'm also going to transfer this to the main cordova repo as a discussion. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer! I have tried this. I get a warning that themes.xml doesn't exist and thus the config-file directive will be ignored. I am guessing that config-file gets applied before the themes.xml file gets dynamically created. Do I need to create an after prepare hook script to edit the contents of the themes.xml file, perhaps replacing the </style> tag with the < item> plus </style> ? I'm not sure how I would implement that script in node.js though. |
Beta Was this translation helpful? Give feedback.
-
I could achieve this using an after_prepare script.
`
` 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. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When opening my cordova app from deep links, the Android splash screen icon doesn't show.
I found out this is by design in Android, and to have it show, I need to add this to the theme style:
<item name="android:windowSplashScreenBehavior">icon_preferred</item>
How can I add this to the themes.xml file that is dynamically created by cordova cli when I compile the app?
Android documentation https://developer.android.com/develop/ui/views/launch/splash-screen#set-theme
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions