- How do I set app orientation?
- Is it possible to create a background service using Intel XDK?
- How do I send an email from my App?
- How do you create an offline application?
- How do I work with alarms and timed notifications?
- How do I get a reliable device ID?
- How do I implement In-App purchasing in my app?
- How do I install custom fonts on devices?
- How do I access the device's file storage?
- Why isn't AppMobi* push notification services working?
- How do I configure an app to run as a service when it is closed?
- How do I dynamically play videos in my app?
- How do I design my Cordova* built Android* app for tablets?
- How do I resolve icon related issues with Cordova* CLI build system?
- Is there a plugin I can use in my App to share content on social media?
- Iframe does not load in my app. Is there an alternative?
- Why are intel.xdk.istablet and intel.xdk.isphone not working?
- How do I enable security in my app?
- Why does my build fail with Admob plugins? Is there an alternative?
- Why does the intel.xdk.camera plugin fail? Is there an alternative?
- How do I resolve Geolocation issues with Cordova?
- Is there an equivalent Cordova* plugin for intel.xdk.player.playPodcast? If so, how can I use it?
- How do I display a webpage in my app without leaving my app?
- Does Cordova* media have callbacks in the emulator?
- Why does the Cordova version number not match the Projects tab's Build Settings CLI version number, the Emulate tab, App Preview and my built app?
- How do I add a third party plugin?
- How do I make an AJAX call that works in my browser work in my app?
- I get an "intel is not defined" error, but my app works in Test tab, App Preview and Debug tab. What's wrong?
- How do I target my app for use only on an iPad or only on an iPhone?
- Why does my build fail when I try to use the Cordova* Capture Plugin?
- How can I pinch and zoom in my Cordova* app?
- How do I make my Android application use the fullscreen so that the status and navigation bars disappear?
- How do I add XXHDPI and XXXHDPI icons to my Android or Crosswalk application?
- Which plugin is the best to use with my app?
- What are the rules for my App ID?
- iOS /usr/bin/codesign error: certificate issue for iOS app?
- iOS Code Sign error: bundle ID does not match app ID?
- iOS build error?
- What are plugin variables used for? Why do I need to supply plugin variables?
- What happened to the Intel XDK "legacy" build options?
- Which build files do I submit to the Windows Store and which do I use for testing my app on a device?
- How do I implement local storage or SQL in my app?
- How do I prevent my app from auto-completing passwords?
- Why does my PHP script not run in my Intel XDK Cordova app?
- Why doesn’t my Cocos2D game work on iOS?
- How do I change the alias of my Intel XDK Android keystore certificate?
- What causes "The connection to the server was unsuccessful. (file:///android_asset/www/index.html)" error?
- How do I manually sign my Android or Crosswalk APK file with the Intel XDK?
- Why should I avoid using the additions.xml file? Why should I use the Plugin Management Tool in the Intel XDK?
- How do I fix this "unknown error: cannot find plugin.xml" when I try to remove or change a plugin?
- Why do I get a "build failed: the plugin contains gradle scripts" error message?
- How does one remove gradle dependencies for plugins that use Google Play Services (esp. push plugins)?
How do I set app orientation?
You set the orientation under the Build Settings section of the Projects tab.
To control the orientation of an iPad you may need to create a simply plugin that contains a single plugin.xml
file like the following:
<config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true"><string></string></config-file><config-file target="*-Info.plist" parent="UISupportedInterfaceOrientations~ipad" overwrite="true"><array><string>UIInterfaceOrientationPortrait</string></array></config-file>
Then add the plugin as a local plugin using the plugin manager on the Projects tab.
HINT: to import the plugin.xml file you created above, you must select the folder that contains the plugin.xml file; you cannot select the plugin.xml file itself, using the import dialg, because a typical plugin consists of many files, not a single plugin.xml. The plugin you created based on the instructions above only requires a single file, it is an atypical plugin.
Alternatively, you can use this plugin: https://github.com/yoik/cordova-yoik-screenorientation. Import it as a third-party Cordova* plugin using the plugin manager with the following information:
- cordova-plugin-screen-orientation
- specify a version (e.g. 1.4.0) or leave blank for the "latest" version
Or, you can reference it directly from its GitHub repo:
- github.com/yoik/cordova-yoik-screenorientation.git
- and specify "tag" v1.4.0
To use the screen orientation plugin referenced above you must add some JavaScript code to your app to manipulate the additional JavaScript API that is provided by this plugin. Simply adding the plugin will not automatically fix your orientation, you must add some code to your app that takes care of this. See the plugin's GitHub repo for details on how to use that API.
Is it possible to create a background service using Intel XDK?
Background services require the use of specialized Cordova* plugins that need to be created specifically for your needs. Intel XDK does not support development or debug of plugins, only the use of them as "black boxes" with your HTML5 app. Background services can be accomplished using Java on Android or Objective C on iOS. If a plugin that backgrounds the functions required already exists (for example, this plugin for background geo tracking), Intel XDK's build system will work with it.
How do I send an email from my App?
You can use the Cordova* email plugin or use web intent - PhoneGap* and Cordova* 3.X.
How do you create an offline application?
You can use the technique described here by creating an offline.appcache file and then setting it up to store the files that are needed to run the program offline. Note that offline applications need to be built using the Cordova* or Legacy Hybrid build options.
How do I work with alarms and timed notifications?
Unfortunately, alarms and notifications are advanced subjects that require a background service. This cannot be implemented in HTML5 and can only be done in native code by using a plugin. Background services require the use of specialized Cordova* plugins that need to be created specifically for your needs. Intel XDK does not support the development or debug of plugins, only the use of them as "black boxes" with your HTML5 app. Background services can be accomplished using Java on Android or Objective C on iOS. If a plugin that backgrounds the functions required already exists (for example, this plugin for background geo tracking) the Intel XDK's build system will work with it.
How do I get a reliable device ID?
You can use the Phonegap/Cordova* Unique Device ID (UUID) plugin for Android*, iOS* and Windows* Phone 8.
How do I implement In-App purchasing in my app?
There is a Cordova* plugin for this. A tutorial on its implementation can be found here. There is also a sample in Intel XDK called 'In App Purchase' which can be downloaded here.
How do I install custom fonts on devices?
Fonts can be considered as an asset that is included with your app, not shared among other apps on the device just like images and CSS files that are private to the app and not shared. It is possible to share some files between apps using, for example, the SD card space on an Android* device. If you include the font files as assets in your application then there is no download time to consider. They are part of your app and already exist on the device after installation.
How do I access the device's file storage?
You can use HTML5 local storage and this is a good article to get started with. Alternatively, there is aCordova* file plugin for that.
Why isn't AppMobi* push notification services working?
This seems to be an issue on AppMobi's end and can only be addressed by them. PushMobi is only available in the "legacy" container. AppMobi* has not developed a Cordova* plugin, so it cannot be used in the Cordova* build containers. Thus, it is not available with the default build system. We recommend that you consider using the Cordova* push notification plugin instead.
How do I configure an app to run as a service when it is closed?
If you want a service to run in the background you'll have to write a service, either by creating a custom plugin or writing a separate service using standard Android* development tools. The Cordova* system does not facilitate writing services.
How do I dynamically play videos in my app?
- Download the Javascript and CSS files from https://github.com/videojs and include them in your project file.
- Add references to them into your
index.html
file. - Add a panel 'main1' that will be playing the video. This panel will be launched when the user clicks on the video in the main panel.
<div class="panel" id="main1" data-appbuilder-object="panel" style=""><video id="example_video_1" class="video-js vjs-default-skin" controls="controls" preload="auto" width="200" poster="camera.png" data-setup="{}"><source src="JAIL.mp4" type="video/mp4"><p class="vjs-no-js">To view this video please enable JavaScript*, and consider upgrading to a web browser that <a href=http://videojs.com/html5-video-support/ target="_blank">supports HTML5 video</a></p></video><a onclick="runVid3()" href="#" class="button" data-appbuilder-object="button">Back</a></div>
- When the user clicks on the video, the click event sets the 'src' attribute of the video element to what the user wants to watch.
Function runVid2(){ Document.getElementsByTagName("video")[0].setAttribute("src","appdes.mp4"); $.ui.loadContent("#main1",true,false,"pop"); }
- The 'main1' panel opens waiting for the user to click the play button.
NOTE: The video does not play in the emulator and so you will have to test using a real device. The user also has to stop the video using the video controls. Clicking on the back button results in the video playing in the background.
How do I design my Cordova* built Android* app for tablets?
This page lists a set of guidelines to follow to make your app of tablet quality. If your app fulfills the criteria for tablet app quality, it can be featured in Google* Play's "Designed for tablets" section.
How do I resolve icon related issues with Cordova* CLI build system?
Ensure icon sizes are properly specified in the intelxdk.config.additions.xml. For example, if you are targeting iOS 6, you need to manually specify the icons sizes that iOS* 6 uses.
<icon platform="ios" src="images/ios/72x72.icon.png" width="72" height="72" /><icon platform="ios" src="images/ios/57x57.icon.png" width="57" height="57" />
These are not required in the build system and so you will have to include them in the additions file.
For more information on adding build options using intelxdk.config.additions.xml, visit: /en-us/html5/articles/adding-special-build-options-to-your-xdk-cordova-app-with-the-intelxdk-config-additions-xml-file
Is there a plugin I can use in my App to share content on social media?
Yes, you can use the PhoneGap Social Sharing plugin for Android*, iOS* and Windows* Phone.
Iframe does not load in my app. Is there an alternative?
Yes, you can use the inAppBrowser plugin instead.
Why are intel.xdk.istablet and intel.xdk.isphone not working?
Those properties are quite old and is based on the legacy AppMobi* system. An alternative is to detect the viewport size instead. You can get the user's screen size using screen.width and screen.height properties (refer to this article for more information) and control the actual view of the webview by using the viewport meta tag (this page has several examples). You can also look through this forum thread for a detailed discussion on the same.
How do I enable security in my app?
We recommend using the App Security API. App Security API is a collection of JavaScript API for Hybrid HTML5 application developers. It enables developers, even those who are not security experts, to take advantage of the security properties and capabilities supported by the platform. The API collection is available to developers in the form of a Cordova plugin (JavaScript API and middleware), supported on the following operating systems: Windows, Android & iOS.
For more details please visit: https://software.intel.com/en-us/app-security-api.
For enabling it, please select the App Security plugin on the plugins list of the Project tab and build your app as a Cordova Hybrid app. After adding the plugin, you can start using it simply by calling its API. For more details about how to get started with the App Security API plugin, please see the relevant sample app articles at: https://software.intel.com/en-us/xdk/article/my-private-photos-sample and https://software.intel.com/en-us/xdk/article/my-private-notes-sample.
Why does my build fail with Admob plugins? Is there an alternative?
Intel XDK does not support the library project that has been newly introduced in the com.google.playservices@21.0.0 plugin. Admob plugins are dependent on "com.google.playservices", which adds Google* play services jar to project. The "com.google.playservices@19.0.0" is a simple jar file that works quite well but the "com.google.playservices@21.0.0" is using a new feature to include a whole library project. It works if built locally with Cordova CLI, but fails when using Intel XDK.
To keep compatible with Intel XDK, the dependency of admob plugin should be changed to "com.google.playservices@19.0.0".
Why does the intel.xdk.camera plugin fail? Is there an alternative?
There seem to be some general issues with the camera plugin on iOS*. An alternative is to use the Cordova camera plugin, instead and change the version to 0.3.3.
How do I resolve Geolocation issues with Cordova?
Give this app a try, it contains lots of useful comments and console log messages. However, use Cordova 0.3.10 version of the geo plugin instead of the Intel XDK geo plugin. Intel XDK buttons on the sample app will not work in a built app because the Intel XDK geo plugin is not included. However, they will partially work in the Emulator and Debug. If you test it on a real device, without the Intel XDK geo plugin selected, you should be able to see what is working and what is not on your device. There is a problem with the Intel XDK geo plugin. It cannot be used in the same build with the Cordova geo plugin. Do not use the Intel XDK geo plugin as it will be discontinued.
Geo fine might not work because of the following reasons:
- Your device does not have a GPS chip
- It is taking a long time to get a GPS lock (if you are indoors)
- The GPS on your device has been disabled in the settings
Geo coarse is the safest bet to quickly get an initial reading. It will get a reading based on a variety of inputs, but is usually not as accurate as geo fine but generally accurate enough to know what town you are located in and your approximate location in that town. Geo coarse will also prime the geo cache so there is something to read when you try to get a geo fine reading. Ensure your code can handle situations where you might not be getting any geo data as there is no guarantee you'll be able to get a geo fine reading at all or in a reasonable period of time. Success with geo fine is highly dependent on a lot of parameters that are typically outside of your control.
Is there an equivalent Cordova* plugin for intel.xdk.player.playPodcast? If so, how can I use it?
Yes, there is and you can find the one that best fits the bill from the Cordova* plugin registry.
To make this work you will need to do the following:
- Detect your platform (you can use uaparser.js or you can do it yourself by inspecting the user agent string)
- Include the plugin only on the Android* platform and use <video> on iOS*.
- Create conditional code to do what is appropriate for the platform detected
You can force a plugin to be part of an Android* build by adding it manually into the additions file. To see what the basic directives are to include a plugin manually:
- Include it using the "import plugin" dialog, perform a build and inspect the resulting intelxdk.config.android.xml file.
- Then remove it from your Project tab settings, copy the directive from that config file and paste it into the intelxdk.config.additions.xml file. Prefix that directive with <!-- +Android* -->.
More information is available here and this is what an additions file can look like:
<preference name="debuggable" value="true" /><preference name="StatusBarOverlaysWebView" value="false" /><preference name="StatusBarBackgroundColor" value="#000000" /><preference name="StatusBarStyle" value="lightcontent" /><!-- -iOS* --><intelxdk:plugin intelxdk:value="nl.nielsad.cordova.wifiscanner" /><!-- -Windows*8 --><intelxdk:plugin intelxdk:value="nl.nielsad.cordova.wifiscanner" /><!-- -Windows*8 --><intelxdk:plugin intelxdk:value="org.apache.cordova.statusbar" /><!-- -Windows*8 --><intelxdk:plugin intelxdk:value="https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin" />
This sample forces a plugin included with the "import plugin" dialog to be excluded from the platforms shown. You can include it only in the Android* platform by using conditional code and one or more appropriate plugins.
How do I display a webpage in my app without leaving my app?
The most effective way to do so is by using inAppBrowser.
Does Cordova* media have callbacks in the emulator?
While Cordova* media objects have proper callbacks when using the debug tab on a device, the emulator doesn't report state changes back to the Media object. This functionality has not been implemented yet. Under emulation, the Media object is implemented by creating an <audio> tag in the program under test. The <audio> tag emits a bunch of events, and these could be captured and turned into status callbacks on the Media object.
Why does the Cordova version number not match the Projects tab's Build Settings CLI version number, the Emulate tab, App Preview and my built app?
This is due to the difficulty in keeping different components in sync and is compounded by the version numbering convention that the Cordova project uses to distinguish build tool versions (the CLI version) from platform versions (the Cordova target-specific framework version) and plugin versions.
The CLI version you specify in the Projects tab's Build Settings section is the "Cordova CLI" version that the build system uses to build your app. Each version of the Cordova CLI tools come with a set of "pinned" Cordova platform framework versions, which are tied to the target platform.
NOTE: the specific Cordova platform framework versions shown below are subject to change without notice.
Our Cordova CLI 4.1.2 build system was "pinned" to:
- cordova-android@3.6.4 (Android Cordova platform version 3.6.4)
- cordova-ios@3.7.0 (iOS Cordova platform version 3.7.0)
- cordova-windows@3.7.0 (Cordova Windows platform version 3.7.0)
Our Cordova CLI 5.1.1 build system is "pinned" to:
- cordova-android@4.1.1 (as of March 23, 2016)
- cordova-ios@3.8.0
- cordova-windows@4.0.0
Our Cordova CLI 5.4.1 build system is "pinned" to:
- cordova-android@5.0.0
- cordova-ios@4.0.1
- cordova-windows@4.3.1
Our Cordova CLI 6.2.0 build system is "pinned" to:
- cordova-android@5.1.1
- cordova-ios@4.1.1
- cordova-windows@4.3.2
Our CLI 6.2.0 build system is nearly identical to a standard Cordova CLI 6.2.0 installation. A standard 6.2.0 installation differs slightly from our build system because it specifies the cordova-io@4.1.0 and cordova-windows@4.3.1 platform versions There are no differences in the cordova-android platform versions.
Our CLI 5.4.1 build system really should be called "CLI 5.4.1+" because the platform versions it uses are closer to the "pinned" versions in the Cordova CLI 6.0.0 release than those "pinned" in the original CLI 5.4.1 release.
Our CLI 5.1.1 build system has been deprecated, as of August 2, 2016 and will be retired with an upcoming fall, 2016 release of the Intel XDK. It is highly recommended that you upgrade your apps to build with Cordova CLI 6.2.0, ASAP.
The Cordova platform framework version you get when you build an app does not equal the CLI version number in the Build Settings section of the Projects tab; it equals the Cordova platform framework version that is "pinned" to our build system's CLI version (see the list of pinned versions, above).
Technically, the target-specific Cordova platform frameworks can be updated [independently] for a given version of CLI tools. In some cases, our build system may use a Cordova platform version that is later than the version that was "pinned" to that version of the CLI when it was originally released by the Cordova project (that is, the Cordova platform versions originally specified by the Cordova CLI x.y.z links above).
You may see Cordova platform version differences in the Simulate tab, App Preview and your built app due to:
The Simulate tab uses one specific Cordova framework version. We try to make sure that the version of the Cordova platform it uses closely matches the current default Intel XDK version of Cordova CLI.
App Preview is released independently of the Intel XDK and, therefore, may use a different platform version than what you will see reported by the Simulate tab or your built app. Again, we try to release App Preview so it matches the version of the Cordova framework that is considered to be the default version for the Intel XDK at the time App Preview is released; but since the various tools are not always released in perfect sync, that is not always possible.
Your app is built with a "pinned" Cordova platform version, which is determined by the Cordova CLI version you specified in the Projects tab's Build Settings section. There are always at least two different CLI versions available in the Intel XDK build system.
For those versions of Crosswalk that were built with the Intel XDK CLI 4.1.2 build system, the cordova-android framework version was determined by the Crosswalk project, not by the Intel XDK build system.
When building an Android-Crosswalk app with Intel XDK CLI 5.1.1 and later, the cordova-android framework version equals the "pinned" cordova-android platform version for that CLI version (see lists above).
Do these Cordova platform framework version numbers matter? Occasionally, yes, but normally, not that much. There are some issues that come up that are related to the Cordova platform version, but they tend to be rare. The majority of the bugs and compatibility issues you will experience in your app have more to do with the versions and mix of Cordova plugins you choose to use and the HTML5 webview runtime on your test devices. See When is an HTML5 Web App a WebView App? for more details about what a webview is and how the webview affects your app.
The "default version" of CLI that the Intel XDK build system uses is rarely the most recent version of the Cordova CLI tools distributed by the Cordova project. There is always a lag between Cordova project releases and our ability to incorporate those releases into our build system and other Intel XDK components. In addition, we are not able to provide every CLI release that is made available by the Cordova project.
How do I add a third party plugin?
Please follow the instructions on this doc page to add a third-party plugin: Adding Plugins to Your Intel® XDK Cordova* App -- this plugin is not being included as part of your app. You will see it in the build log if it was successfully added to your build.
How do I make an AJAX call that works in my browser work in my app?
Please follow the instructions in this article: Cordova CLI 4.1.2 Domain Whitelisting with Intel XDK for AJAX and Launching External Apps.
I get an "intel is not defined" error, but my app works in Test tab, App Preview and Debug tab. What's wrong?
When your app runs in the Test tab, App Preview or the Debug tab the intel.xdk and core Cordova functions are automatically included for easy debug. That is, the plugins required to implement those APIs on a real device are already included in the corresponding debug modules.
When you build your app you must include the plugins that correspond to the APIs you are using in your build settings. This means you must enable the Cordova and/or XDK plugins that correspond to the APIs you are using. Go to the Projects tab and insure that the plugins you need are selected in your project's plugin settings. See Adding Plugins to Your Intel® XDK Cordova* App for additional details.
How do I target my app for use only on an iPad or only on an iPhone?
There is an undocumented feature in Cordova that should help you (the Cordova project provided this feature but failed to document it for the rest of the world). If you use the appropriate preference in theintelxdk.config.additions.xml
file you should get what you need:
<preference name="target-device" value="tablet" /> <!-- Installs on iPad, not on iPhone --><preference name="target-device" value="handset" /> <!-- Installs on iPhone, iPad installs in a zoomed view and doesn't fill the entire screen --><preference name="target-device" value="universal" /> <!-- Installs on iPhone and iPad correctly -->
If you need info regarding the additions.xml file, see the blank template or this doc file: Adding Intel® XDK Cordova Build Options Using the Additions File.
Why does my build fail when I try to use the Cordova* Capture Plugin?
The Cordova* Capture plugin has a dependency on the File Plugin. Please make sure you both plugins selected on the projects tab.
How can I pinch and zoom in my Cordova* app?
For now, using the viewport meta tag is the only option to enable pinch and zoom. However, its behavior is unpredictable in different webviews. Testing a few samples apps has led us to believe that this feature is better on Crosswalk for Android. You can test this by building the Hello Cordova sample app for Android and Crosswalk for Android. Pinch and zoom will work on the latter only though they both have:
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=yes, minimum-scale=1, maximum-scale=2">.
Please visit the following pages to get a better understanding of when to build with Crosswalk for Android:
http://blogs.intel.com/evangelists/2014/09/02/html5-web-app-webview-app/
https://software.intel.com/en-us/xdk/docs/why-use-crosswalk-for-android-builds
Another device oriented approach is to enable it by turning on Android accessibility gestures.
How do I make my Android application use the fullscreen so that the status and navigation bars disappear?
The Cordova* fullscreen plugin can be used to do this. For example, in your initialization code, include this function AndroidFullScreen.immersiveMode(null, null);
.
You can get this third-party plugin from here https://github.com/mesmotronic/cordova-fullscreen-plugin
How do I add XXHDPI and XXXHDPI icons to my Android or Crosswalk application?
The Cordova CLI 4.1.2 build system will support this feature, but our 4.1.2 build system (and the 2170 version of the Intel XDK) does not handle the XX and XXX sizes directly. Use this workaround until these sizes are supported directly:
- copy your XX and XXX icons into your source directory (usually named
www
) - add the following lines to your
intelxdk.config.additions.xml
file - see this Cordova doc page for some more details
Assuming your icons and splash screen images are stored in the "pkg" directory inside your source directory (your source directory is usually named www
), add lines similar to these into yourintelxdk.config.additions.xml
file (the precise name of your png files may be different than what is shown here):
<!-- for adding xxhdpi and xxxhdpi icons on Android --><icon platform="android" src="pkg/xxhdpi.png" density="xxhdpi" /><icon platform="android" src="pkg/xxxhdpi.png" density="xxxhdpi" /><splash platform="android" src="pkg/splash-port-xhdpi.png" density="port-xhdpi"/><splash platform="android" src="pkg/splash-land-xhdpi.png" density="land-xhdpi"/>
The precise names of your PNG files are not important, but the "density" designations are very important and, of course, the respective resolutions of your PNG files must be consistent with Android requirements. Those density parameters specify the respective "res-drawable-*dpi" directories that will be created in your APK for use by the Android system. NOTE: splash screen references have been added for reference, you do not need to use this technique for splash screens.
You can continue to insert the other icons into your app using the Intel XDK Projects tab.
Which plugin is the best to use with my app?
We are not able to track all the plugins out there, so we generally cannot give you a "this is better than that" evaluation of plugins. Check the Cordova plugin registry to see which plugins are most popular and check Stack Overflow to see which are best supported; also, check the individual plugin repos to see how well the plugin is supported and how frequently it is updated. Since the Cordova platform and the mobile platforms continue to evolve, those that are well-supported are likely to be those that have good activity in their repo.
Keep in mind that the XDK builds Cordova apps, so whichever plugins you find being supported and working best with other Cordova (or PhoneGap) apps would likely be your "best" choice.
See Adding Plugins to Your Intel® XDK Cordova* App for instructions on how to include third-party plugins with your app.
What are the rules for my App ID?
The precise App ID naming rules vary as a function of the target platform (eg., Android, iOS, Windows, etc.). Unfortunately, the App ID naming rules are further restricted by the Apache Cordova project and sometimes change with updates to the Cordova project. The Cordova project is the underlying technology that your Intel XDK app is based upon; when you build an Intel XDK app you are building an Apache Cordova app.
CLI 5.1.1 has more restrictive App ID requirements than previous versions of Apache Cordova (the CLI version refers to Apache Cordova CLI release versions). In this case, the Apache Cordova project decided to set limits on acceptable App IDs to equal the minimum set for all platforms. We hope to eliminate this restriction in a future release of the build system, but for now (as of the 2496 release of the Intel XDK), the current requirements for CLI 5.1.1 are:
- Each section of the App ID must start with a letter
- Each section can only consist of letters, numbers, and the underscore character
- Each section cannot be a Java keyword
- The App ID must consist of at least 2 sections (each section separated by a period ".").
iOS /usr/bin/codesign error: certificate issue for iOS app?
If you are getting an iOS build fail message in your detailed build log that includes a reference to a signing identity error you probably have a bad or inconsistent provisioning file. The "no identity found" message in the build log excerpt, below, means that the provisioning profile does not match the distribution certificate that was uploaded with your application during the build phase.
Signing Identity: "iPhone Distribution: XXXXXXXXXX LTD (Z2xxxxxx45)" Provisioning Profile: "MyProvisioningFile" (b5xxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxe1) /usr/bin/codesign --force --sign 9AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxA6 --resource-rules=.../MyApp/platforms/ios/build/device/MyApp.app/ResourceRules.plist --entitlements .../MyApp/platforms/ios/build/MyApp.build/Release-iphoneos/MyApp.build/MyApp.app.xcent .../MyApp/platforms/ios/build/device/MyApp.app 9AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxA6: no identity found Command /usr/bin/codesign failed with exit code 1 ** BUILD FAILED ** The following build commands failed: CodeSign build/device/MyApp.app (1 failure)
The excerpt shown above will appear near the very end of the detailed build log. The unique number patterns in this example have been replaced with "xxxx" strings for security reasons. Your actual build log will contain hexadecimal strings.
iOS Code Sign error: bundle ID does not match app ID?
If you are getting an iOS build fail message in your detailed build log that includes a reference to a "Code Sign error" you may have a bad or inconsistent provisioning file. The "Code Sign" message in the build log excerpt, below, means that the bundle ID you specified in your Apple provisioning profile does not match the app ID you provided to the Intel XDK to upload with your application during the build phase.
Code Sign error: Provisioning profile does not match bundle identifier: The provisioning profile specified in your build settings (MyBuildSettings) has an AppID of my.app.id which does not match your bundle identifier my.bundleidentifier. CodeSign error: code signing is required for product type 'Application' in SDK 'iOS 8.0' ** BUILD FAILED ** The following build commands failed: Check dependencies (1 failure) Error code 65 for command: xcodebuild with args: -xcconfig,...
The message above translates into "the bundle ID you entered in the project settings of the XDK does not match the bundle ID (app ID) that you created on Apples developer portal and then used to create a provisioning profile."
iOS build error?
If your iOS build is failing with Error code 65 with Xcodebuild in the error log, most likely there are issues with certificate and provisioning profile. Sometimes Xcode gives specific errors as “Provisioning profile does not match bundle identifier” and other times something like "Code Sign error: No codesigning identities found: No code signing identities". The root of the issues come from not providing the correct certificate (P12 file) and/or provisioning profile or mismatch between P12 and provisioning profile. You have to make sure your P12 and provisioning profile are correct. The provisioning profile has to be generated using the certificate you used to create the P12 file. Also, your app ID you provide in XDK build settings has to match the app ID created on the Apple Developer portal and the same App ID has to be used when creating a provisioning profile.
Please follow these steps to generate the P12 file.
- Create a .csr file from Intel XDK (do not close the dialog box to upload .cer file)
- Click on the link Apple Developer Portal from the dialog box (do not close the dialog box in XDK)
- Upload .csr on Apple Developer Portal
- Generate certificate on Apple developer portal
- Download .cer file from the Developer portal
- Come back to XDK dialog box where you left off from step 1, press Next. Select .cer file that you got from step 5 and generate .P12 file
- Create an appID on Apple Developer Portal
- Generate a Provisioning Profile on Apple Developer Portal using the certificate you generated in step 4 and appID created in step 7
- Provide the same appID (step 7), P12 (step 6) and Provisioning profile (step 8) in Intel XDK Build Settings
Few things to check before you build:
- Make sure your certificate has not expired
- The appID you created on Apple developer portal matches with the appID you provided in the XDK build settings
- You are using provisioning profile that is associated with the certificate you are using to build the app
- Apple allows only 3 active certificate, if you need to create a new one, revoke one of the older certificate and create a new one.
This App Certificate Management video shows how to create a P12 and provisioning profile , the P12 creation part is at 16:45 min. Please follow the process for creating a P12 and generating Provisioning profile as shown in the video. Or follow this Certificate Management document.
What are plugin variables used for? Why do I need to supply plugin variables?
Some plugins require details that are specific to your app or your developer account. For example, to authorize your app as an app that belongs to you, the developer, so services can be properly routed to the service provider. The precise reasons are dependent on the specific plugin and its function.
What happened to the Intel XDK "legacy" build options?
On December 14, 2015 the Intel XDK legacy build options were retired and are no longer available to build apps. The legacy build option is based on three year old technology that predates the current Cordova project. All Intel XDK development efforts for the past two years have been directed at building standard Apache Cordova apps.
Many of the intel.xdk
legacy APIs that were supported by the legacy build options have been migrated to standard Apache Cordova plugins and published as open source plugins. The API details for these plugins are available in the README.md
files in the respective 01.org GitHub repos. Additional details regarding the new Cordova implementations of the intel.xdk
legacy APIs are available in the doc page titled Intel XDK Legacy APIs.
Standard Cordova builds do not require the use of the "intelxdk.js" and "xhr.js" phantom scripts. Only the "cordova.js" phantom script is required to successfully build Cordova apps. If you have been including "intelxdk.js" and "xhr.js" in your Cordova builds they have been quietly ignored. You should remove references to these files from your "index.html" file; leaving them in will do no harm, it simply results in a warning that the respective script file cannot be found at runtime.
The Emulate tab will continue to support some legacy intel.xdk APIs that are NOT supported in the Cordova builds (only those intel.xdk APIs that are supported by the open source plugins are available to a Cordova built app, and only if you have included the respective intel.xdk plugins). This Emulate tab discrepancy will be addressed in a future release of the Intel XDK.
More information can be found in this forum post > https://software.intel.com/en-us/forums/intel-xdk/topic/601436.
Which build files do I submit to the Windows Store and which do I use for testing my app on a device?
There are two things you can do with the build files generated by the Intel XDK Windows build options: side-load your app onto a real device (for testing) or publish your app in the Windows Store (for distribution). Microsoft has changed the files you use for these purposes with each release of a new platform. As of December, 2015, the packages you might see in a build, and their uses, are:
- appx works best for side-loading, and can also be used to publish your app.
- appxupload is preferred for publishing your app, it will not work for side-loading.
- appxbundle will work for both publishing and side-loading, but is not preferred.
- xap is for legacy Windows Phone; works for both publishing and side-loading.
In essence: XAP (WP7) was superseded by APPXBUNDLE (Win8 and WP8.0), which was superseded by APPX (Win8/WP8.1/UAP), which has been supplemented with APPXUPLOAD. APPX and APPXUPLOAD are the preferred formats. For more information regarding these file formats, see Upload app packages on the Microsoft developer site.
Side-loading a Windows Phone app onto a real device, over USB, requires a Windows 8+ development system (see Side-Loading Windows* Phone Apps for complete instructions). If you do not have a physical Windows development machine you can use a virtual Windows machine or use the Window Store Beta testing and targeted distribution technique to get your app onto real test devices.
Side-loading a Windows tablet app onto a Windows 8 or Windows 10 laptop or tablet is simpler. Extract the contents of the ZIP file that you downloaded from the Intel XDK build system, open the "*_Test" folder inside the extracted folder, and run the PowerShell script (ps1 file) contained within that folder on the test machine (the machine that will run your app). The ps1 script file may need to request a "developer certificate" from Microsoft before it will install your test app onto your Windows test system, so your test machine may require a network connection to successfully side-load your Windows app.
The side-loading process may not over-write an existing side-loaded app with the same ID. To be sure your test app properly side-loads, it is best to uninstall the old version of your app before side-loading a new version on your test system.
How do I implement local storage or SQL in my app?
See this summary of local storage options for Cordova apps written by Josh Morony, A Summary of Local Storage Options for PhoneGap Applications.
How do I prevent my app from auto-completing passwords?
Use the Ionic Keyboard plugin and set the spellcheck attribute to false.
Why does my PHP script not run in my Intel XDK Cordova app?
Your XDK app is not a page on a web server; you cannot use dynamic web server techniques because there is no web server associated with your app to which you can pass off PHP scripts and similar actions. When you build an Intel XDK app you are building a standalone Cordova client web app, not a dynamic server web app. You need to create a RESTful API on your server that you can then call from your client (the Intel XDK Cordova app) and pass and return data between the client and server through that RESTful API (usually in the form of a JSON payload).
Please see this StackOverflow post and this article by Ray Camden, a longtime developer of the Cordova development environment and Cordova apps, for some useful background.
Following is a lightly edited recommendation from an Intel XDK user:
I came from php+mysql web development. My first attempt at an Intel XDK Cordova app was to create a set of php files to query the database and give me the JSON. It was a simple job, but totally insecure.
Then I found dreamfactory.com, an open source software that automatically creates the REST API functions from several databases, SQL and NoSQL. I use it a lot. You can start with a free account to develop and test and then install it in your server. Another possibility is phprestsql.sourceforge.net, this is a library that does what I tried to develop by myself. I did not try it, but perhaps it will help you.
And finally, I'm using PouchDB and CouchDB"A database for the web." It is not SQL, but is very useful and easy if you need to develop a mobile app with only a few tables. It will also work with a lot of tables, but for a simple database it is an easy place to start.
I strongly recommend that you start to learn these new ways to interact with databases, you will need to invest some time but is the way to go. Do not try to use MySQL and PHP the old fashioned way, you can get it work but at some point you may get stuck.
Why doesn’t my Cocos2D game work on iOS?
This is an issue with Cocos2D and is not a reflection of our build system. As an interim solution, we have modified the CCBoot.js file for compatibility with iOS and App Preview. You can view an example of this modification in this CCBoot.js file from the Cocos2d-js 3.1 Scene GUI sample. The update has been applied to all cocos2D templates and samples that ship with Intel XDK.
The fix involves two lines changes (for generic cocos2D fix) and one additional line (for it to work on App Preview on iOS devices):
Generic cocos2D fix -
1. Inside the loadTxt function, xhr.onload should be defined as
xhr.onload = function () { if(xhr.readyState == 4) xhr.responseText != "" ? cb(null, xhr.responseText) : cb(errInfo); };
instead of
xhr.onload = function () { if(xhr.readyState == 4) xhr.status == 200 ? cb(null, xhr.responseText) : cb(errInfo); };
2. The condition inside _loadTxtSync function should be changed to
if (!xhr.readyState == 4 || (xhr.status != 200 || xhr.responseText != "")) {
instead of
if (!xhr.readyState == 4 || xhr.status != 200) {
App Preview fix -
Add this line inside of loadTxtSync after _xhr.open:
xhr.setRequestHeader("iap_isSyncXHR", "true");
How do I change the alias of my Intel XDK Android keystore certificate?
You cannot change the alias name of your Android keystore within the Intel XDK, but you can download the existing keystore, change the alias on that keystore and upload a new copy of the same keystore with a new alias.
Use the following procedure:
Download the converted legacy keystore from the Intel XDK (the one with the bad alias).
Locate the keytool app on your system (this assumes that you have a Java runtime installed on your system). On Windows, this is likely to be located at
%ProgramFiles%\Java\jre8\bin
(you might have to adjust the value ofjre8
in the path to match the version of Java installed on your system). On Mac and Linux systems it is probably located in your path (in/usr/bin
).Change the alias of the keystore using this command (see the
keytool -changealias -help
command for additional details):
keytool -changealias -alias "existing-alias" -destalias "new-alias" -keypass keypass -keystore /path/to/keystore -storepass storepass
Import this new keystore into the Intel XDK using the "Import Existing Keystore" option in the "Developer Certificates" section of the "person icon" located in the upper right corner of the Intel XDK.
What causes "The connection to the server was unsuccessful. (file:///android_asset/www/index.html)" error?
See this forum thread for some help with this issue. This error is most likely due to errors retrieving assets over the network or long delays associated with retrieving those assets.
How do I manually sign my Android or Crosswalk APK file with the Intel XDK?
To sign an app manually, you must build your app by "deselecting" the "Signed" box in the Build Settings section of the Android tab on the Projects tab:
Follow these Android developer instructions to manually sign your app. The instructions assume you have Java installed on your system (for the jarsigner and keytool utilities). You may have to locate and install the zipalign tool separately (it is not part of Java) or download and install Android Studio.
These two sections of the Android developer Signing Your Applications article are also worth reading:
- Signing Your Applications: Signing Considerations
- Signing Your Applications: Securing Your Private Key
Why should I avoid using the additions.xml file? Why should I use the Plugin Management Tool in the Intel XDK?
Intel XDK (2496 and up) now includes a Plugin Management Tool that simplifies adding and managing Cordova plugins. We urge all users to manage their plugins from existing or upgraded projects using this tool. If you were using intelxdk.config.additions.xml file to manage plugins in the past, you should remove them and use the Plugin Management Tool to add all plugins instead.
Why you should be using the Plugin Management Tool:
It can now manage plugins from all sources. Popular plugins have been added to the the Featured plugins list. Third party plugins can be added from the Cordova Plugin Registry, Git Repo and your file system.
Consistency: Unlike previous versions of the Intel XDK, plugins you add are now stored as a part of your project on your development system after they are retrieved by the Intel XDK and copied to your plugins directory. These plugin files are delivered, along with your source code files, to the Intel XDK cloud-based build server. This change ensures greater consistency between builds, because you always build with the plugin version that was retrieved by the Intel XDK into your project. It also provides better documentation of the components that make up your Cordova app, because the plugins are now part of your project directory. This is also more consistent with the way a standard Cordova CLI project works.
Convenience: In the past, the only way to add a third party plugin that required parameters was to include it in the intelxdk.config.additions.xml file. This plugin would then be added to your project by the build system. This is no longer recommended. With the new Plugin Management Tool, it automatically parses the plugin.xml file and prompts to add any plugin variables from within the XDK.
When a plugin is added via the Plugin Management Tool, a plugin entry is added to the project file and the plugin source is downloaded to the plugins directory making a more stable project. After a build, the build system automatically generates config xml files in your project directory that includes a complete summary of plugins and variable values.Correctness of Debug Module: Intel XDK now provides remote on-device debugging for projects with third party plugins by building a custom debug module from your project plugins directory. It does not write or read from the intelxdk.config.additions.xml and the only time this file is used is during a build. This means the debug module is not aware of your plugin added via the intelxdk.config.additions.xml file and so adding plugins via intelxdk.config.additions.xml file should be avoided. Here is a useful article for understanding Intel XDK Build Files.
Editing Plugin Sources: There are a few cases where you may want to modify plugin code to fix a bug in a plugin, or add console.log messages to a plugin's sources to help debug your application's interaction with the plugin. To accomplish these goals you can edit the plugin sources in the plugins directory. Your modifications will be uploaded along with your app sources when you build your app using the Intel XDK build server and when a custom debug module is created by the Debug tab.
How do I fix this "unknown error: cannot find plugin.xml" when I try to remove or change a plugin?
Removing a plugin from your project generates the following error:
Sometimes you may see this error:
This is not a common problem, but if it does happen it means a file in your plugin directory is probably corrupt (usually one of the json files found inside the plugins folder at the root of your project folder).
The simplest fix is to:
- make a list of ALL of your plugins (esp. the plugin ID and version number, see image below)
- exit the Intel XDK
- delete the entire plugins directory inside your project
- restart the Intel XDK
The XDK should detect that all of your plugins are missing and attempt to reinstall them. If it does not automatically re-install all or some of your plugins, then reinstall them manually from the list you saved in step one (see the image below for the important data that documents your plugins).
NOTE: if you re-install your plugins manually, you can use the third-party plugin add feature of the plugin management system to specify the plugin id to get your plugins from the Cordova plugin registry. If you leave the version number blank the latest version of the plugin that is available in the registry will be retrieved by the Intel XDK.
Why do I get a "build failed: the plugin contains gradle scripts" error message?
You will see this error message in your Android build log summary whenever you include a Cordova plugin that includes a gradle script in your project. Gradle scripts add extra Android build instructions that are needed by the plugin.
The current Intel XDK build system does not allow the use of plugins that contain gradle scripts because they present a security risk to the build system and your Intel XDK account. An unscrupulous user could use a gradle-enabled plugin to do harmful things with the build server. We are working on a build system that will insure the necessary level of security to allow for gradle scripts in plugins, but until that time, we cannot support those plugins that include gradle scripts.
The error message in your build summary log will look like the following:
In some cases the plugin gradle script can be removed, but only if you manually modify the plugin to implement whatever the gradle script was doing automatically. In some cases this can be done easily (for example, the gradle script may be building a JAR library file for the plugin), but sometimes the plugin is not easily modified to remove the need for the gradle script. Exactly what needs to be done to the plugin depends on the plugin and the gradle script.
You can find out more about Cordova plugins and gradle scripts by reading this section of the Cordova documentation. In essence, if a Cordova plugin includes a build-extras.gradle
file in the plugin's root folder, or if it contains one or more lines similar to the following, inside the plugin.xml
file:
<framework src="some.gradle" custom="true" type="gradleReference" />
it means that the plugin contains gradle scripts and will be rejected by the Intel XDK build system.
How does one remove gradle dependencies for plugins that use Google Play Services (esp. push plugins)?
Our Android (and Crosswalk) CLI 5.1.1 and CLI 5.4.1 build systems include a fix for an issue in the standard Cordova build system that allows some Cordova plugins to be used with the Intel XDK build system without their included gradle script!
This fix only works with those Cordova plugins that include a gradle script for one and only one purpose: to set the value of applicationID
in the Android build project files (such a gradle script copies the value of the App ID from your project's Build Settings, on the Projects tab, to this special project build variable).
Using the phonegap-plugin-push
as an example, this Cordova plugin contains a gradle script named push.gradle, that has been added to the plugin and looks like this:
import java.util.regex.Pattern def doExtractStringFromManifest(name) { def manifestFile = file(android.sourceSets.main.manifest.srcFile) def pattern = Pattern.compile(name + "=\"(.*?)\"") def matcher = pattern.matcher(manifestFile.getText()) matcher.find() return matcher.group(1) } android { sourceSets { main { manifest.srcFile 'AndroidManifest.xml' } } defaultConfig { applicationId = doExtractStringFromManifest("package") } }
All this gradle script is doing is inserting your app's "package ID" (the "App ID" in your app's Build Settings) into a variable called applicationID
for use by the build system. It is needed, in this example, by the Google Play Services library to insure that calls through the Google Play Services API can be matched to your app. Without the proper App ID the Google Play Services library cannot distinguish between multiple apps on an end user's device that are using the Google Play Services library, for example.
The phonegap-plugin-push
is being used as an example for this article. Other Cordova plugins exist that can also be used by applying the same technique (e.g., the pushwoosh-phonegap-plugin
will also work using this technique). It is important that you first determine that only one gradle script is being used by the plugin of interest and that this one gradle script is used for only one purpose: to set the applicationID
variable.
How does this help you and what do you do?
To use a plugin with the Intel XDK build system that includes a single gradle script designed to set the applicationID
variable:
Download a ZIP of the plugin version you want to use (e.g. version 1.6.3) from that plugin's git repo.
IMPORTANT:be sure to download a released version of the plugin, the "head" of the git repo may be "under construction" -- some plugin authors make it easy to identify a specific version, some do not, be aware and careful when choosing what you clone from a git repo!Unzip that plugin onto your local hard drive.
Remove the <framework> line that references the gradle script from the
plugin.xml
file.Add the modified plugin into your project as a "local" plugin (see the image below).
In this example, you will be prompted to define a variable that the plugin also needs. If you know that variable's name (it's called SENDER_ID for this plugin), you can add it using the "+" icon in the image above, and avoid the prompt. If the plugin add was successful, you'll find something like this in the Projects tab:
If you are curious, you can inspect the AndroidManifest.xml
file that is included inside your built APK file (you'll have to use a tool like apktool
to extract and reconstruct it from you APK file). You should see something like the following highlighted line, which should match your App ID, in this example, the App ID was io.cordova.hellocordova
:
If you see the following App ID, it means something went wrong. This is the default App ID for the Google Play Services library that will cause collisions on end-user devices when multiple apps that are using Google Play Services use this same default App ID: