-
How do I set app orientation? If you are using Cordova* 3.X build options (Crosswalk* for Android*, Android*, iOS*, etc.), you can set the orientation under the Projects panel > Select your project > Cordova* 3.X Hybrid Mobile App Settings - Build Settings. Under the Build Settings, you can set the Orientation for your desired mobile platform.
If you are using the Legacy Hybrid Mobile App Platform build options (Android*, iOS* Ad Hoc, etc.), you can set the orientation under the Build tab > Legacy Hybrid Mobile App Platforms Category- <desired_mobile_platform> - Step 2 Assets tab.
[iPad] Create a plugin (directory with one file) that only has a config xml that includes 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>
Add the plugin on the build settings page.
Alternatively, you can use this plugin: https://github.com/yoik/cordova-yoik-screenorientation. You can import it as a third-party Cordova* plugin using the Cordova* registry notation:
- net.yoik.cordova.plugins.screenorientation (includes latest version at the time of the build)
- net.yoik.cordova.plugins.screenorientation@1.3.2 (specifies a version)
Or, you can reference it directly from the GitHub repo:
- github.com/yoik/cordova-yoik-screenorientation.git
- github.com/yoik/cordova-yoik-screenorientation.git#06b93e6
The second reference provides the git commit referenced here (we do not support pulling from the PhoneGap registry).
-
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 ? [Device] - 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? [Plugin] - 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 ? [Plugin] - You can use HTML5 local storage and this is a good article to get started with. Alternatively, there is a Cordova* file plugin for that.
-
Why isn't AppMobi* push notification services working? [Plugin] - 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? 1) Download the Javascript and CSS files from https://github.com/videojs
2) Add them in the HTML5 header.
<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>
3) 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=”” 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>
4) 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”); }
5) 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 ? [Android*] - 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? [Build] 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: https://software.intel.com/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 ? [Plugin] 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? [Plugin] - Yes, you can use the inAppBrowser plugin instead.
-
Why are intel.xdk.istablet and intel.xdk.isphone not working? [Plugin] - 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 work with the App Security plugin on Intel XDK? [Plugin] Select the App Security plugin on the plugins list of the Project tab and build your app as a Cordova Hybrid app. Building it as a Legacy Hybrid app has been known to cause issues when compiled and installed on a device.
-
Why does my build fail with Admob plugins ? Is there an alternative? [Plugin] 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? [Plugin] - 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? [Plugin] 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? [Plugin] 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.
↧
Intel® XDK FAQs - Cordova
↧