Today we officially launched PhoneGap 3.0 support for PhoneGap Build. You can read the blog post on it here: PhoneGap 3.0 Now Supported in PhoneGap Build Before you get started, there are a few things I want to call out.
The first thing you should note is that Build is not yet defaulting to 3.0 when you create a new project. If you want to use 3.0, please be sure to specify it in the config.xml file:
<preference name="phonegap-version" value="3.0.0" />
Next - if you remember my blog post on PhoneGap 3 (PhoneGap 3.0 Released - Things You Should Know), then you remember that the biggest change was to core features. In order to use any of the core features you must include the plugin for it.
PhoneGap Build also has this rule!
In order to include a core plugin with your PhoneGap Build project, simply add the gap:plugin tag to your config.xml file. Here is an example:
<gap:plugin name="org.apache.cordova.core.camera" />
<gap:plugin name="org.apache.cordova.core.geolocation" />
<gap:plugin name="org.apache.cordova.core.dialogs" />
PhoneGap Build now has a "Plugins" tab for each project. This is a great way to confirm that you set up the config.xml correctly:
If you forget the value for a particular plugin, or want to see what PhoneGap Build supports from third parties, just hit the Plugins tab at the very top of the page. The list of supported third-party plugins seems to be much improved!
Finally, don't forget to peruse the doc updates. We recently launched the ability to select a platform. among other updates.
Archived Comments
Strange the plugins gelocation and dialogs error on me when i command line build to build.phonegap.com.
Plugin Unsupported: org.apache.cordova.core.geolocation
The com.phonegap.plugins.barcodescanner does not error.
Chad, have you updated the PhoneGap CLI recently?
=Ryan
ryan@adobe.com
I ran npm install -g phonegap again today and i get the same result.
http://chadgray.info/misc/u...
I am a total newbie to this CLI stuff so i am probably doing something wrong.
Looks like i had to add this line to my config file.
<preference name="phonegap-version" value="3.0.0" />
Chad, I was going to mention this in my blog post but changed my mind at the last minute. Now I wish I didn't. If you remember, I said 3.0 is *not* the default. If you try to use the new plugins and don't specify 3.0, it will not work.
I think i picked a bad day to download the CLI yesterday. I installed and was reading up on everything before the build.phonegap.com was updated to support 3.0. I remember the website being down for about a half hour yesterday when i was experimenting.
I will start over today and re-download everything and create new projects etc. This will give me a fresh start.
Thanks for all the help!
The CLI and build.phonegap.com really seems to make this a lot easier.
Now if i can get an SSL cert out of XCODE i will be super happy to start using build.phonegap.com. We are trying to figure out all the provisioning file/SSL certificate stuff today.
Hmmm, I don't remember doing anything "CLI" related with PGB 2.x. Can someone please point out what (pertaining to this topic) boat I missed?
Thank you
Steve, the CLI has been around for a while, but got improved over time and is integral to PG3. See the article I linked to.
Raymond,
On the same day as announcing 3.0 support, Cordova comes out with 3.1. 3.1 has some pretty significant updates to deal with iOS 7.
Any idea when Phonegap will be updated?
From what I know it should be pretty darn soon.
Hey Raymond, how are you doing today?
I was writing the phonegap version of the Android Bluetooth Chat app, for that I was writing a plugin. The question is (please bare with my usage of inappropriate words) that how do I make a request from the (java) plugin and receive it in JS? I know that we can use the _CallbackContext_ class to send back the result, but for that you have to initiate it from the JS itself, so how can I initiate it (a request) from the java plugin?
Hoping for a reply. Thanks in advance.
Anas, I've never written a plugin so unfortunately I can't help. Best I can suggest is the docs. Also consider this article from my coworker:
http://devgirl.org/2013/09/...
when it support webgl?
It isn't a question of PhoneGap supporting it - it is a question of the mobile browser supporting it.
i create game with construct 2 and i use webgl in it but when i export my game for mobile with phonegap, it didn't work!
but for example, Firefox mobile support it.
On Android, PhoneGap uses the stock Android browser. On iOS, Mobile Safari. It does not use Firefox Mobile.
As an additional tip, I ran into this just now with an older app. I added a gap:plugin line to add Camera support, but when I uploaded the file, I got a config.xml error. Turns out, I had forgotten to add this to my root element:
xmlns:gap = "http://phonegap.com/ns/1.0"
When including a phonegap plugin the documentation states that you have to reference the JavaScript code for the plugin, however I have so far found it very difficult to work out what JavaScript file to reference, the documentation doesn't seem to tell me.
In this example I am using network-information. So I tried including network-information.js and it works, however it also works when I don't include the script, I presume in this case it won't pull in the relevant adaptor and so may fail on other devices.
Any tips on how to include these plugins would be greatly appreciated.
Actually, no, you do not need to do so. Also see this: http://www.raymondcamden.co...
Is PhoneGap 3.1 wacky with plugins? I am trying to make the switch to Build and it is very confusing. I am getting a lot of plugin not supported errors.
It shouldn't be. If you can share a precise, simple example, I can try to help. Or you can try the PhoneGap listserv too.
Ray if I use Phonegap CLI, add plugins I see them in my main app folder. I then build for iOS and the plugins do not show up in the platform plugin folder. I can open the project in XCode and in the yellow folders my Plugins folder is empty, yet in my www folder under plugins I see them. If I try to do a remote build the project says no plugins.
I'm having a similar problem with splash and icon. Both are in my www/res folder, but never make it to my yellow Resources/icons or splash folders.
I seem to have two config.xml folders too. One in the main project and one in my www folder. www config.xml points to <gap:plugin name="org.apache.cordova.inappbrowser"/> and the one in the main folder has the <feature name> structure that points to CDVInAppBrowser.
So here is what I discovered. There is a file in the main folder plugins that is called iOS.json. When I deleted that, reran build iOS, my plugins showed up. I had deleted the platforms iOS folder but apparently there are other files floating around with old information. I'm hoping there is one for splash and icons somewhere too.
No deal on splash and icons. Trying to use CLI with both local build and remote build is kind of a mess.
Here is a nice informative CLI error:
[error] error occured while building the iOS app
Um... ok thanks, and the app actually built remotely.
For remote builds, you need to use www/config.xml to load plugins (and set settings like icons). It can be a bit confusing.
I'm attempting to use Build since that seems like a more Adobe supported route but there is a lot of confusing documentation. Plugins are really strange. We add them via CLI, then add to the www/config.xml, then add the .js in index.html? What about the ones that are core. They seem to be listed as plugins but also as features?
Another thing I'm not really getting is if I want to build both locally and remotely I'm almost creating two projects within the main folder. The reason I feel the need to build locally is I have no idea what is being logged. In XCode I can at least view what is happening with say the GA plugin or PushWoosh. In Build I have no idea what is happening. I'm reading about some additional steps to get debug going for Build but why can't I just build a project and choose remote or local?
Everything you use now has to be added as a plugin. If you are ONLY using PGB, then you need to edit config.xml as I described. I believe you can skip the CLI to add them as you won't be building locally anyway.
As to your second question- I'd build locally if I were trying to debug. You can do both. Not sure I quite get your question.
I gave up on Phonegap Build. What about icons and splash for local build? Are these not being built with CLI and we go into each OS and add? Doesn't seem like there is any documentation. My app seems to be using the www/config.xml for those and using main config.xml for other stuff.
For those, you are expected to do it as per the platform's documentation. So you would need to check Android for how to do it there, iOS for how to do it there. That's my understanding and that www/config.xml was NOT meant for anything local. But it has been a while since I last spoke to an engineer about that and I could be wrong. Best bet would be to hit the PhoneGap Google group and ask, and let us know.
Please I created the phonegap 3.0 . imported it into eclipse but i dont have the plugin.xml file, please how do i create it thanks.
This blog post is about PhoneGap Build, not PhoneGap itself. I don't think PhoneGap/Android uses plugin.xml. I used the CLI to make a new PG project, added Android, added the camera plugin, and I do not see a plugin.xml. As it stands, you should just let the CLI handle it.
Phonegap plugin not supported issue: For some reason the way these plugins need to be named in the config.xml isn't congruent with the documentation. For example: org.apache.cordova.camera will result in "plugin not supported: camera" but: org.apache.cordova.core.camera will build just fine. The way the plugin is listed on the phonegap plugins page is: org.apache.cordova.camera. This is NOT how you want to specify it in the config.xml file. I suspect the same is true for other plugins. Hope this helps someone.
This directly contradicts the value on the plugins site: https://build.phonegap.com/.... I'm going to confirm and write up a bug report.
I am not able to confirm this. The app built for me. Can you tell me more about your settings?
Hi I need phonegap plugin for bluetooth communication purpose .
Give me advice for me
Check the plugins directory - http://plugins.cordova.io/
Is it possible to use the Storage API of Phonegap (org.apache.cordova.storage) with phonegap build? I don't see the phonegap build plugin for it, and when I check the File plugin, it says the following "For an overview of other storage options, refer to Cordova's storage guide." but if I try to add a plugin with the cordova storage url it returns an error when building.
Is this API included in the File API of phonegap build plugin or is it not yet implemented?
I believe we removed the plugins for websql as it is naturally supported. It should "just work."
Oh those are great news! I'm using localStorage at the moment for a small application, but I'll check it out later for sure! thanks so much for your quick reply.
issue with .app path (ios)
After starting the app iam copying certain files to my Library folder and so it resides in the Library\files\....
Now from one of the html page in this folder i want to refer to a js file in the app package, which iam unable to do.
Earlier i was using somthing like
<script type="text/javascript" src="../../../myapp.app/www/js/myscript.js"></script>
which is not working now for the new file api.
cordova version - 3.4
Kindly let me know how i can give the path.
Hmm. If you look at the FileSystem docs, there is a compat setting you can try, but I don't think that is it. Honestly - why not just keep the JS file "under" your app? What is the point of copying it out?
Hello Sir
The issue is the js is in the app path,. I am moving the html file to Library\Files which has got update later. So from this file i require js functionality which aim referring to in the app path.
<appname>.app\js\...
please let me know
You can overwrite the existing JS under the app path - as far as I know. So why not try that?
Hello Sir
The issue is small but iam unable to implement it.
I guess i did not put forth my problem right.
On one side i have my (myapp.app) package.
On the other side i copied few files to Library folder ( which requires future updates)
One such file in the Library folder is an html which loads svg file.
But this svg file refers to js files like (jquery.js, myscript.js,jquerymobile.js)
So in this html file.
i have to give js path which is located in myapp.app\www\js\
<script type="text/javascript" src="../../../../../myapp.app/www/js/myscript.js"></script>
This worked earlier before the file api update but now it does not work. It is not going inside the myapp.app path at all.
kindly let me know your suggestion.
sir the files (jquery.js, myscript.js,jquerymobile.js) that the SVG html file refers to are in the myapp.app package.
Thanks
@murali: Sorry - you got me there.
I'm trying to use the device-motion plugin with Phonegap build but I don't seem to be getting very far. Do I *only* need to add the plugin to my config.xml and then use the navigator.accelerometer methods? Or is there a step I'm missing (CLI, reference something else). I think I'm getting confused with the different documentation from PG and PG Build.
Thanks in advance.
That should be it. If you are still having issues I'd suggest debugging.
Ok. Thanks for the quick reply.
let's face it: PhoneGap, cordova, plugins, javascript, html .... they are a total crap. Any programmer "normal" would think.
Heh, you so funny.
HTML. Total crap! Javascript. Crap!
Web. Crap! Obviously it won't succeed!
Oh wait...
hello
i'm using phonegap 3.6.0 and cordova 3.3.1
when i'm using adobe build phonegap i get "class not found error"
and under the 'tab' plugins i see "This application has no plugins"
the plugin i use is for example cordova plugin add org.apache.cordova.device
and my own plugin.
p.s when i'm install it through the USB it works fine but when it installed through the QR he didn't recognized the java classes.
what can be the problem ?
You didn't say what your own plugin was - is it supported by PGB? You can't use random plugins with PGB - it has to be supported.
my plugin is notification plugin.
i just want to know why when i install trought USB and build.phonegap i got two different result?
and sorry but what is pgb?
PGB = PhoneGap Build.
USB implies you built locally where your plugin works just fine, but via QR means PGB. Again, your plugin may not be supported there.
so how do i know if supported PGB OR how can i fix it ?
Click the Plugins link on top. It takes you here: https://build.phonegap.com/...
thanks but it didn't help me to understand why it's doesn't work.
maybe the way i defined my plugin
https://github.com/avishayh...
PGB doesn't support random plugins. So when you told PGB to build your app, it couldn't include your plugin.
thank you very much.
you helped me!
but if i want to build something for myself can i do that?
Yes - you can use any plugin you want if you develop locally.