Apache Cordova gains Windows 8.1 and Windows Phone 8.1 support

Building on the latest version of Apache Cordova 3.6.x, Microsoft Open Technologies, Inc. has contributed to Cordova Core to support Microsoft Windows 8.1 and Windows Phone 8.1. This version update is now available on GitHub here . There are many more repos where this work was done, most notable here . So it is highly recommended to install this version from NPM to be sure to obtain all the bits correctly:using for example this command:

npm install cordova

This release offers Windows platform support by default to developers so that they can take full advantage of Cordova’s integrated platform model to expand the reach of their apps to the growing base of Windows mobile devices worldwide. MS OpenTech team ’modify’ the command line argument for Cordova CLI: Windows. In fact this argument produces three ‘platforms’ at the same time: Windows 8.0, Windows 8.1 and Windows Phone 8.1.

Executing the command: cordova platform add windows

clip_image001

If you have preexisting projects, you can migrate it to the new platform. To perform the upgrade from ‘windows8’ to ‘windows’ platform, in your command line add this:

cordova platform update windows8

This version introduces new command line switches -win and –phone useable with the build and run commands to specify desired target (tablet/PC vs Phone):

# build tablet/PC version only : cordova build windows -- --win

# build Phone only : cordova build windows -- --phone

# deploy app on phone emulator: cordova emulate windows -- --phone

# deploy tablet/PC build on local machine: cordova run windows -- --win

In the Windows directory you’ll find CordovaApp.sln, the solution file for Visual Studio, open

clip_image003

It in and you’ll have this project structure, composed of four projects:

clip_image004

This solution structure is totally inspired by Universal App on Windows, providing multiple projects on the same solution. One project containing the shared code, here CordovaApp, with the default html page and code (index.html and index.js in the js folder)

clip_image005

In the three other projects, you’ll find specific files resources for platform. The solution content a project for Windows8, one for Windows8.1 and one for Windows Phone 8.1.

clip_image007

Of course you can build all the application without Visual Studio, in the build directory, you’ll find three sub directory with all the files needed to build for these different platforms.

clip_image008

As usual, your input serves as a valuable influence to the quality of these bits as well as for our contributions to the ongoing evolution of the platform. Please take an active part in reporting issues and proposing improvements, either through the Cordova project on GitHub or by leaving comments for us below.

Thank you!

 

Parashuram Narasimhan
Senior Program Manager
Microsoft Open Technologies, Inc

Eric Mittelette
Senior Technical Evangelist
Microsoft Open Technologies, Inc


32 thoughts on “Apache Cordova gains Windows 8.1 and Windows Phone 8.1 support

  1. Universal App is not a good choice for mulit-platform hybrid mobile application. There are some security limitations for modifing DOM and common libraries like jquery, angularjs, ionic does not work out of the box. It is better to use old wp8 platform and retarget to wp8.1 of course some there are also some issues.

    • Hi Tomasz
      It is correct that the security model for Universal apps is different than for the usual Webview control, and the reason is to ensure apps that have full OS resources access don’t expose the user. If you want to inject your favorite JavaScript library into a Cordova app running on Windows Phone 8.1 or Windows 8.x, we recommend you try to include the JavaScript Dynamic Content shim from GitHub (https://github.com/MsopenTech/winstore-jscompat). With this library, you can unblock the setbacks and use your favorite JS libraries in a secure environment, still benefitting from direct access to OS resources directly from your JS code. Hope this helps.
      – Olivier

      • Hi! This solution has solved my problem with jquery and knockout but now i have a new problem as i use gmaps api

        and when i use: new google.maps.LatLng the system throw exception: google is undefined

        do you know why?

        thanks!

      • The problem is that even if I use winstore-jscompat, it still would not let me to access remote javascript such as Google map or MapQuest map unless I run those scripts in an iframe. Talking about an iframe, according to the documentation, it resembles a WebView control the most (it’s even more flexible than the new WebView Control in 8.1 as it supports appcache, for example.) The documentation said it is a web (remote) context. It also seems that you can pass data back and forth the local and web (remote) contexts. The question is why Cordova for Windows was not implemented such as it is included within the iframe, and it has code in both the local context (similar to iOS/Android’s native code) and the web/remote context (similar to WebView)? That will probably solve most of the problems and make the existing HTML5 java script code most portable across different platforms.

  2. Pingback: Apache Cordova gains Windows 8.1 and Windows Ph...

  3. Pingback: Apache Cordova Adds Windows 8.1 and Windows Phone 8.1 Universal Apps Support - Expo E-News

  4. Pingback: Apache Cordova Adds Windows 8.1 and Windows Phone 8.1 Universal Apps Support

  5. Pingback: Java Annotated Monthly – October 2014 | JetBrains IntelliJ IDEA Blog

  6. Pingback: Windows Phone 8.1 – Some useful links for developing Windows “Universal Apps” | Enzo Contini Blog

  7. Pingback: Apache Cordova and WinJS | Windows Admins

  8. Pingback: Apache Cordova and WinJS | Dinesh Ram Kali.

    • For IndexedDB, we are aware of the fact that 8.1 does not support IndexedDB and have passed the feedback to the Microsoft Windows team. For now, the websql plugin works.
      For the CSS animations, we would need a little more data. It would be great if we have a code snippet where this happens.

      • @ericmitt I would really appreciate any comment you could give regarding your reply here. What exactly do yo mean with:

        For now, the websql plugin works.

        Do you maybe mean using the cordova websql plugin would enable the indexedDB functionality for the WebView on Windows 8.1? If so how exactly should I go for it?

        Currently running my App on Windows 8.1 as a Web-App using Internet-Explorer the native IndexedDB support of the browser works like a charm, however running the _same_ App using the WebView (through the “cordova run” command) IndexedDB doesn’t work! Any clue if there’re any workaround to make this work?

        Thanks in advance for any help!

  9. Although it is nice to see first steps in “Cordova & VS” , there is something wrong with the approach you took:
    1) Cordova offical documentation nicely states that you modify and change ONLY root WWW folder. You simply ignored such an important thing.
    Side-effect: a) you create new project with ‘cordova .create ……’
    b) you add platform support with ‘cordova platform add windows’
    c) Open solution inside ‘platforms/windows/*.sln’
    d) make a change to index.html inside VS and run project
    e) close the app, go to command prompt and inside your project: type ‘cordova build’ or ‘cordova build windows’
    f) Whatever you changed inside platforms/windows/www/index.html is now overrun! What now I am wondering :-)
    I am missing something? How do you envision team is working on such a solution?
    2) Although *.sln created with ‘cordova platform add windows’ creates 4 projects and one shared-universal app folder (www), all ‘projects’ lead to same files. Question: how do you expect specific adjustments for wp8 or w8.1 when they are all the same files and one folder…?
    Suggestion: write a detailed post on how to work with this type of solution, quirks, how to change it etc. This will be of great value.
    Thank you & keep up the good work :-)

    • The Cordova support is based on Windows Web Apps (WWA). WinJS is just a cross-platform javascript library, and Cordova apps for windows does not required WinJS.
      The Cordova implementation for Windows is based on WWA since it is very powerful and makes writing plugins much easy. WWA also makes debugging apps much easier. We are aware of the security restrictions and are actively working on addressing them in the next version of Windows.

      • Hi, ericmitt

        I am a bit confused. When open the sln in VS, the project “CordovaApp.Phone(Windows Phone 8.1) has a reference to “Windows Library for JavaScript 2.1″. Isn’t it mean that it depends on WinJS ?

        I am just wondering whether there will be something in Windows Phone 8.1/later version that build upon WebView in C#, just like cordova on Windows Phone 8.0 which build upon WebBrowser in C#

  10. After cordova emulate winodws — –phone I get:
    ERROR: Error code -2146233088 for command: C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.1\Tools\AppDeploy\AppDeployCmd.exe with args: /install,e:\dev\config-demo-phonegap\finance-application\platforms\windows\AppPackages\CordovaApp.Phone_0.0.1.0_debug_Test\CordovaApp.Phone_0.0.1.0_AnyCPU_debug.appxbundle,/targetdevice:xd
    Error: e:\dev\config-demo-phonegap\finance-application\platforms\windows\cordova\run.bat: Command failed with exit code 2
    at ChildProcess.whenDone (C:\Users\timoshkois\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

  11. Now a days mobile technology updated day by day and modern browsers offer outstanding performance and web standards support so we see a growing tendency to build cross-platform apps with HTML5. This approach has both positives and negatives when compared to native app development that can, and should, influence decisions when making a choice for development but Apache Cordova helps me lot to save running my windows phone. Thank you Windows phone always come up with new technical updates.

  12. Windows is the third biggest operating system after Android and iOS and many cross platform mobile app developers also want to make apps for windows phone operating system. This is a good thing for phoneGap developers that now PhoneGap also gives an extreme support for windows8.1 operating system. Now they can easily fulfill clients requirements whether they want windows based phone gap mobile applications.

  13. Pingback: Experiences with Ionic on Windows Phone 8.1 | Ville Rantala

  14. Pingback: 開發跨平台的APP - 談 Visual Studio 2015 整合 Apache Cordova 的原因 - MSDN 台灣部落格 - Site Home - MSDN Blogs

  15. Pingback: Building a Cordova plugin including native code for Windows platform | Ville Rantala