Cordova 3.x and Windows Phone 8 plugin woes

1,602 views
Skip to first unread message

Julian Herrera

unread,
Oct 9, 2013, 10:58:24 AM10/9/13
to phon...@googlegroups.com
First of all, all of this has been a total pain.
 
BUT, after a lot of frustration errors and setup woes I got the template for visual studio to work and the app launches and connects to a device.
 
I then sort of set up requirejs (again, due to a total lack of documentation regarding supposed support out of the box for requirejs, I used a standard script tag, just loading it before the require tag).
 
Again, everything seems to be working.
 
Now the fun part:
 
1) Can't use CLI to add plugins since CLI wasn't used to create project and doesn't recognize it as a valid cordova project.
 
2) Can't use CLI to create a new project since I can't add wp8 as a platform (MSbuild error) so I can't copy over plugins by making them elsewhere.
 
3) Finally found documentation on how to install plugins using plugman and this seemed to work. It created the files, folders and structures needed and seemed to make changes to plugin.xml and config.xml as well as apppackagemanifest whatever.
 
However, navigator (when stringified for debugging yields "{ }" and obviously navigator.camera.getPicture is referencing an undefined object.)
 
How are people use plugins for WP8? Is cordova worth it or has my process of every "simple" step taking hours been indicative of a lot of people experiences?
Additionally, and I'll start a new thread for this, but just in case. Is there any CLEAR documentation on using require with cordova NOT based on 2.x but based on the new supposedly AMD-ready 3.x version.
 
Also, plugman documentation is here: http://cordova.apache.org/docs/en/edge/plugin_ref_plugman.md.html. I write this since it doesn't seem to have any inbound links from elsewhere in the documentation and I was lucky to find it through search.

Conor R.

unread,
Oct 9, 2013, 1:41:03 PM10/9/13
to phon...@googlegroups.com
I'd suggest https://npmjs.org/package/plugman as the plugman link instead. As the docs get it wrong again by leaving out the 'install' parameter in the command to add a plugin for each parameter. The phonegap/cordova documentation is atrocious at times. I'm following your instructions here to add my first plugin. Definitely not as simple as they make it seem. But that's where programming gets you.

Julian Herrera

unread,
Oct 9, 2013, 4:45:23 PM10/9/13
to phon...@googlegroups.com
I think, and unfortunately I can't test this until I get home, its an issue of more specificity.  I see now in the plugin page, arguments to pass for the plugin directory and the www directory. As it stands, I think it may just need more specificity as its seems using visual studio to develop causes the directory structure to be different (ie. no platform folder, etc.) and since installing plugins I now have 2 www folders and 2 Plugin folders. I will report back what I found.
 
Yeah the documentation is total crap, if I get the combo of cordova, wp8, require, knockout playing well I intend to write a very detailed tutorial. (Kudos to Knockout for having stellar documentation compared to the rest, and truth be told it was for this that I chose knockout over other binding frameworks (looking at you backbone). Hint... Features don't matter if I can't figure out how to use them.....)

Julian Herrera

unread,
Oct 9, 2013, 9:10:19 PM10/9/13
to phon...@googlegroups.com
Alright here is the deal:
 
I got plugins working etc etc etc. And can help get you up and running as well. However, I (currently) dropped requirejs from the mix.
 
Get the CLI stuff working. This is KEY. That means you create the project, add the wp8 platform, add plugins, all from the CLI. This used to not work me and that's because I did not have MSBuild.exe in my PATH environment variable. So to get started make sure cordova is in your path directory, msbuild is your path directory and git is in your path directory (for plugins)
 
Once I got all that, I went into the platform wp8 folder and opened my .sln file that was created. From here, everything worked, plugins I called, etc etc.
 
Leads me to the conclusion that ultimately this was a path mixup, either cordova.js can't be moved around or something got created in a weird place by plugman. Whatever it is it very frustrating and not user or developer friendly enough.
 
It seems now I can add requirejs back (since i was ignoring cordova anyway) though the mess cordova made of my project directory will just have to stay presumably.
 
Hopefully native html5/js/css development comes with Windows Phone 8.1 or 8.5 as in Windows 8 because as much as I appreciate a project like this, losing so much control to complex development tools (and terminating with a fairly awful debugging experience with no breakpoints and such) is not my idea of a good time.
 
 
Still: anyone know how to base a project off the templates AND install plugins (plugman can't or won't place these properly apparently, CLI won't work for adding plugins if not CLI-built project)
        anyone know how to use require properly yet with cordova (seems the AMD-ready claim can't possibly be  true given that you barely have freedom to move files around on disk)

Conor R.

unread,
Oct 10, 2013, 7:06:25 AM10/10/13
to phon...@googlegroups.com
Right I've just run into that plugman issue now as I've used the template for VS. Without the docs indicating any use of the CLI for WP8, I assume I can just use it as used with IOS and Android once I get my paths resolved?

Conor R.

unread,
Oct 10, 2013, 8:16:22 AM10/10/13
to phon...@googlegroups.com
Success. Just a brief description for anyone else. With node.js downloaded I run the command to install cordova. This can then be found in the Appdata folder of my pc under roaming/npm/modules/cordova. Add the URL to my PATH environment variable. Then add 'C:\Windows\Microsoft.NET\Framework\v4.0.30319' to the environmental variable. This is where MSBuild.exe resides. Git is not actually required. Run cordova create command. Change directory to the project folder and run 'cordova add platform add wp8'. Finally run 'cordova plugin add org.apache.cordova.<plugin-name>'.  Open Visual Studio and open project '<project-directory>\platforms\wp8\<project.sln>'. Done.

This unfortunately means the project templates are obsolete and that they really need to update the documentation for 3.0.0 so as not to mislead people. On the brighter side the CLI use syncs with how to add other platforms. Running 3 simple commands to start a new project and add a plugin is a breeze so I can't complain. Only about those damn docs. No idea about the use of require. Now onto my FileTransfer.download ordeal.

byron peterson

unread,
Oct 15, 2013, 1:15:46 PM10/15/13
to phon...@googlegroups.com
OMG!!!! Thank you, I was mucking around with this for hours today and finally saw this post...

Jesse

unread,
Oct 15, 2013, 2:19:40 PM10/15/13
to phon...@googlegroups.com
Sorry for all the confusion, and glad you were able to get this all sorted.  I will include this discussion when making suggestions about documentation.
The reason that the project templates still exist, is that you should still be able to create a Windows Phone cordova project without CLI, for example if you only want to develop for Windows Phone.

@purplecabbage


On Thu, Oct 10, 2013 at 5:16 AM, Conor R. <conorr...@gmail.com> wrote:
Success. Just a brief description for anyone else. With node.js downloaded I run the command to install cordova. This can then be found in the Appdata folder of my pc under roaming/npm/modules/cordova. Add the URL to my PATH environment variable. Then add 'C:\Windows\Microsoft.NET\Framework\v4.0.30319' to the environmental variable. This is where MSBuild.exe resides. Git is not actually required. Run cordova create command. Change directory to the project folder and run 'cordova add platform add wp8'. Finally run 'cordova plugin add org.apache.cordova.<plugin-name>'.  Open Visual Studio and open project '<project-directory>\platforms\wp8\<project.sln>'. Done.

This unfortunately means the project templates are obsolete and that they really need to update the documentation for 3.0.0 so as not to mislead people. On the brighter side the CLI use syncs with how to add other platforms. Running 3 simple commands to start a new project and add a plugin is a breeze so I can't complain. Only about those damn docs. No idea about the use of require. Now onto my FileTransfer.download ordeal.

--
-- You received this message because you are subscribed to the Google
Groups "phonegap" group.
To post to this group, send email to phon...@googlegroups.com
To unsubscribe from this group, send email to
phonegap+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/phonegap?hl=en?hl=en
 
For more info on PhoneGap or to download the code go to www.phonegap.com
 
To compile in the cloud, check out build.phonegap.com
---
You received this message because you are subscribed to the Google Groups "phonegap" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phonegap+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

ranjith v

unread,
Apr 17, 2014, 7:58:05 AM4/17/14
to phon...@googlegroups.com
So is there really a way to add plugins to the projects created via templates (ie; not using npm /cli) ?. If yes how?

Jesse

unread,
Apr 17, 2014, 4:01:35 PM4/17/14
to phon...@googlegroups.com
You can install plugins using the 'plugman' tool.
You will still need nodejs installed.
From the command line
Install it (globally):
>  npm install -g plugman
Add a plugin (by id) to the current directory wp8 cordova csproj
> plugman install --plugin org.apache.cordova.camera --platform wp8 --project .

More info:


Hope this helps!
Cheers,
  Jesse


@purplecabbage


For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages