Resurrecting this old thread I think we need a resource-file tag on the config.xml (as the one on plugin.xml) to copy resources to the projects, not just images as this thread started. Examples: Images for push notifications Sounds for push notifications .plist and .json files with user data now required by google frameworks (analytics, FCM, etc)
There is a discussion about this in Cordova discuss https://github.com/cordova/cordova-discuss/issues/6 2015-05-04 15:44 GMT+02:00 Karen Tran <[email protected]>: > Yes, I agree, and the notification icon is a good example. There is nothing > in config.xml that currently does just a copy over, which is why I'm > proposing to add this functionality in. I am actually just using a hook > script to copy the images over right now, but I figure it might be > beneficial to add this feature in since it's very common to have other > sorts of icon images that aren't the main application icon. > > Your suggestion of using a name attribute would work, and might be better > than have a new tag since it would be redundant to have two separate icon > tags doing almost the same thing. > > What did you mean by one-off asset problems on other platforms? > > On Sun, May 3, 2015 at 7:36 PM, Darryl Pogue <[email protected]> wrote: > > > One example that comes to mind is notification icons for Android. It > > used to be fine to reuse the app icon, but as of Lollipop notification > > icons are only transparent and white. If your app icon is square, your > > notification icon will be a white square unless you provide a > > different one. > > > > Currently there's no way to use config.xml to copy a notification icon > > (or any other non-app icon). If you're treating your platforms as > > build artifacts, this means you have to write hooks to copy stuff in > > manually. > > > > Something like > > <icon src="res/android/notification.png" density="mdpi" > > name="ic_notification"> > > would be ideal for that use case. > > > > > > I do think this turns into a slippery slope pretty quickly though, > > because a case can probably be made for all sorts of one-off asset > > problems on other platforms and we probably don't want all of those > > things ending up in config.xml. > > > > On 3 May 2015 at 16:30, Karen Tran <[email protected]> wrote: > > > Buttons were just an example. The image could really be of anything the > > > user wants in the application. > > > > > > What's in cordova now in config.xml is: > > > > > > <icon src="res/android/button.png" platform="android" density="mdpi" /> > > > > > > The line above will copy button.png into the drawable-mdpi directory > and > > > rename it to icon.png, thus replacing the icon.png that is already > there. > > > Of course as a result, my application will be using button.png as the > > main > > > icon. > > > I don't want this. > > > > > > I want a new tag, which is similar to icon, but all it does is copy the > > > image over. No renaming to icon.png. Just plain old copy. > > > > > > <*image* src="res/android/button.png" platform="android" density="mdpi" > > /> > > > > > > In cordova-lib/cordova-lib/src/cordova/metadata/android-parser.js is > > where > > > config.xml gets parsed to handle the icon tag. I believe I can just > reuse > > > the code there for this new tag that I want to create, but I just > wanted > > to > > > see if anyone had any objections. > > > > > > > > > On Sat, May 2, 2015 at 5:12 PM, julio cesar sanchez < > > [email protected]> > > > wrote: > > > > > >> But you want it for native buttons? > > >> If not, you can just put the images on the www folder > > >> > > >> El viernes, 1 de mayo de 2015, Karen Tran <[email protected]> > escribió: > > >> > > >> > I am looking for a way to be able to specify an image in the > > config.xml > > >> and > > >> > have it be placed in the drawable directory. Under my > circumstances, I > > >> have > > >> > to assume that when the user creates a cordova project, he/she only > > knows > > >> > how to modify the config.xml, so that's why I'm pushing for a way to > > do > > >> it > > >> > this way. > > >> > > > >> > I do have a hackish way of doing it by using the preferences tag and > > >> > getting the path to the image, and then having a script copy it > over, > > >> but I > > >> > know the better way to do it would be to just make a tag to take > care > > of > > >> > images that are not going to be the main icon or splash image and > have > > >> > cordova-cli handle it for me when I call cordova prepare. > > >> > > > >> > This isn't really for a plugin, though maybe an app template, but I > > just > > >> > wanted to add this functionality to be able to specify non-icon and > > >> > non-splash images through the config.xml. > > >> > > > >> > I've found where in cordova-lib that the parsing happens for the > icon > > and > > >> > splash tags, so I was proposing to add a new tag for "general > images". > > >> The > > >> > images could be anything that a user might want in his or her app. > An > > >> > example would be a customized button. The user can specify the path > to > > >> the > > >> > image file, and then the image will be dropped into the drawable > > >> directory. > > >> > > > >> > On Fri, May 1, 2015 at 12:27 PM, Jesse <[email protected] > > >> > <javascript:;>> wrote: > > >> > > > >> > > What is the use for the images? Is this for a plugin, or an app > > >> template? > > >> > > I can think of a couple ways to do this, but none would affect > > >> > > configure.xml.but > > >> > > I suggest you look at how the splash screen plugin does this for > > >> android. > > >> > > > > >> > > > > >> > > > > >> > > > On May 1, 2015, at 8:39 AM, Karen Tran <[email protected] > > >> > <javascript:;>> wrote: > > >> > > > > > >> > > > Hi dev-list, > > >> > > > > > >> > > > I wanted to get your input on a feature I want to add to the > > >> > config.xml. > > >> > > > > > >> > > > Currently there are only the icon tag and splash tag that allows > > the > > >> > user > > >> > > > to specify the icon and splash image in the config.xml > > respectively. > > >> > > > > > >> > > > I want to be able to specify multiple images that will be used > in > > my > > >> > app > > >> > > > such as customized buttons. The problem is that the icon tag > will > > >> > rename > > >> > > > the image specified to icon.png, so ultimately the user would > > only be > > >> > > able > > >> > > > to change the main icon. And the splash tag of course handles > the > > >> > splash > > >> > > > image, so I don't want that. > > >> > > > > > >> > > > I propose making a new tag that handles general images. It'll be > > >> > similar > > >> > > to > > >> > > > the icon tag, except it won't rename the image. It will copy the > > >> image > > >> > > from > > >> > > > the src, and drop it into the correct drawable-density directory > > (I > > >> am > > >> > > > working in android). > > >> > > > > > >> > > > I know I can just drop the images myself into the drawable > > folders, > > >> > but I > > >> > > > have to assume that my users won't know the android project > > structure > > >> > and > > >> > > > will only modify the config.xml. > > >> > > > > > >> > > > Any thoughts, comments, or critiques would be appreciated. > > >> > > > > > >> > > > > > >> > > > Regards, > > >> > > > Karen Tran > > >> > > > > >> > > > > --------------------------------------------------------------------- > > >> > > To unsubscribe, e-mail: [email protected] > > >> > <javascript:;> > > >> > > For additional commands, e-mail: [email protected] > > >> > <javascript:;> > > >> > > > > >> > > > > >> > > > >> > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >
