Skip to content Skip to sidebar Skip to footer

Including Resources Folder In Apk

I'm writing a hybrid application in Cordova using Intel XDK. I've found and installed plugin for displaying native notifications on device, but got stuck with problem concerning ic

Solution 1:

Despite the statements in the forum post, it may be possible to do what you are asking about, but not without some effort. The forum post is correct, there is no way to add custom images, for use by the plugin you are trying to use, in your XDK project as described by the plugin docs. In the case of an XDK project, the platform directories pointed to by those plugin docs exist only in the build system, where it uses Cordova CLI to build your app, they do not exist in your local XDK project directory (despite the resemblance to a Cordova CLI project, your local project directory is missing the platform folders).

To do this you'd have to create a simple plugin, that will add those resources into the respective platform folder locations at build time. I'd have to spend some time figuring out precisely how to do this, which I don't have time for right now, but at least wanted to help you give it a try, if you are up for it. :-)

The simplest way to figure this out would be to inspect a plugin that adds custom graphic images to the built app it is being included in. The inAppBrowser is one you could use as a guide, certainly there are others. Inspect the plugin.xml file for that pluginand find the Android platform section where it copies files from the plugin's src directory into the platform's res directory. In essence, what you want to do is create a small custom plugin that contains a plugin.xml file that includes such directives, plus the custom images you want to copy into the respective locations for each platform. So you'd also have an src/android/res/etc... directory containing your Android images, and so on for the other platforms. You may have to look at a few plugins to see how this is done for other platforms.

Here's the plugin guide, most of which you won't need, just the bits to create a basic plugin.xml file and the local images you want to add to your app > https://cordova.apache.org/docs/en/5.1.1/guide/hybrid/plugins/index.html

You'll then have to add this plugin as a "local" plugin to your project, using the Plugin Manager tool. Do not develop your plugin inside the <project>/plugins directory, that is a destination. Develop it somewhere else, either inside your project (e.g., <project>/my-custom-icons) or somewhere outside the project. The Plugin Manager doesn't care where it is located, as long as it is somewhere on your local dev system and NOT inside the <project>/plugins directory.

Solution 2:

I have posted a solution for this problem in this thread: res/drawable files in Intel XDK

Altough I have not yet tested this on iOS, the solution should be similar.

Post a Comment for "Including Resources Folder In Apk"