are you unable to use plugins in build.phonegap.com since version 3.0? - plugins

I was using build.phonegap.com in it's simplest way. That is: no sdk and no phonegap framework installed on my computer; no git or svn repository used. I just upload a zip with my html, css and js files.
But now I need to use the File plugin.
I found several posts (here and elsewhere) taking about using the CLI to add plugins and to build remotely since phonegap 3.0 (which doesn't use the config.xml to add plugins anymore, but instead it uses the CLI).
If you just used to upload a zip file to build.phonegap.com, are you now unable to use plugins since phonegap 3.0??
If that virtue is gone, what is now the simplest way for doing it? I currently use Aptana 3.0. Do I have to install Eclipse and install the phonegap framework? Do I have to create git of svn repository? Is that now the simplest way for using plugins in the cloud-based build service?
Is there a way to use the build.phonegap.com service with phonegap 2.x?? I have not found it yet.
This is taking me out of schedule for the imminent delivery of an ongoing project.
Please advise.

Put the config.xml in the www directory. And then upload only www.zip on build.phone.com.

In phonegap 2.x plugins like File were part of the core, so there was no need to include them through the config.xml file.
In phonegap 3.x every plugin has to be included through the config.xml file. BUT for plugins to work, the root index.html header must have a
<script src="phonegap.js"></script>
phonegap.js is provided (kind of injected) by the build.phonegap.com service, so I don't have to have it on my source code.
The script tag was the only thing I was missing.

Related

Where can I find the Java library for Spreadsheets API 3.0?

According to the documentation it can be downloaded from https://code.google.com/hosting/moved?project=gdata-java-client but this page redirects me to a github project at https://github.com/google/gdata-java-client
Now, when I download the zip from that project, in the lib directory the jar I can only see is gdata-spreadsheet-1.0.jar.
Is it that I have to build the project myself? Isn't there anywhere from where the built library can be downloaded?
Found the solution to this one. "1-0" is the version of the client library and not the version of the API it supports (I know, it's confusing).
A look at the version.properties file, this client library should work with v3 of the Spreadsheet API.

Access Cordova CLI in local Intel-XDK

Intel-XDK uses third party Cordova plugins only at build time. Is there a way to implement a third party plugin using Cordova CLI in my local Intel-XDK environment? In other words, can I access the internal Intel-XDK Cordova server in some way?
EDIT (7 Aug 2015): With our EA release local plugins no longer need to be placed inside your source directory (typically www inside your project directory). The Intel XDK EA release manages plugins in a way that is consistent with Cordova CLI. This CLI-compatible plugin management scheme will become part of the mainstream release in the very near future.
Original Post:
You cannot directly access the XDK build server's CLI. However, you can reference a plugin locally (that is, you can submit a plugin that is located on your local disk drive). Unfortunately, you have to locate the plugin inside your www "source" directory, I hope to see that changed in a future revision of the product; this is not where a local CLI would place the plugin...
Placing the plugin into your www directory, and then referencing it using the "import local plugin" on the Projects tab (find the "Plugins and Permission" and then the "Third-Party Plugins" section) allows you to customize that plugin before it gets submitted to the build service. For example, assume you need to change the contennts of the plugin.xml file or change a plist or manifest file that is part of the plugin, you could do that in the local copy and those changes would be part of this "local third-party plugin" that is submitted to the build server with your app when the build server runs.
In essence, the build server does a plugin add on a copy of the plugin that got submitted along with your project when you use the "import local plugin" feature. A copy of your local plugin gets sent with your app source to the build server and, before the build happens, the build server's CLI performs a plugin add with that plugin, so the changes you implemented locally will be included in the plugin when it is built by the build server. Make sense? :)
There are also some useful things you can do with the intelxdk.config.additions.xml file regarding plugins. See these doc pages for some details:
https://software.intel.com/en-us/html5/xdkdocs#517453
https://software.intel.com/en-us/html5/articles/using-the-cordova-for-android-ios-etc-build-option
The checkmarked plugins on the Project tab refer only to what are called "core" plugins and "featured" plugins. They are really just a convenience for selecting plugins. The "core" plugins also include some simulation inside the Emulate, Test and Debug tabs (as well as in App Preview). Other than that, they are standard Cordova plugins that are also "plugin added" by the build server if they have been checked. Take a look at the various intelxdk.config.*.xml files that are automatically generated when you perform a build to see how the checkmarks (and third-party plugins) are communicated to the build server.

Eclipse import Phonegap project

I have the HTML/JS/config.xml files of an app that was built using online phonegap build. How can I import these files into a project that I can work on with Eclipse/Phonegap CLI ?
The documentation here is all you need, just follow the steps.
http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface
First you will need to create a new project using your existing HTML/JS/CSS/icons
put your files in a folder, let's say c:\oldproject
create a new cordova project using the CLI and tell it to import your existing files (replace foldername, com.test.app and TestApp with proper values)
cordova create foldername com.test.app TestApp --copy-from=c:\oldproject
Replace phonegap.js reference with cordova.js
In index.html, replace the inclusion of phonegap.js with cordova.js (note that you may choose to use phonegap CLI instead of cordova CLI to create/build the project, in that case, you could continue to use phonegap.js)
Then put back the config and add plugins
replace the generated config.xml in the project with the one of your old project
If your config.xml contains plugins (lines begining with <gap:plugin) you will have to use the CLI to add each plugin.
For example if you have the line
<gap:plugin name="org.apache.cordova.file"
you would have to call
cordova plugin add org.apache.cordova.file
Then you have to add the android platform and build the project.
cordova platform add android
cordova build android
Now your project is ready to be imported in eclipse.
Please note that I don't really see any interest in using eclipse now that you can build projects using CLI. (I personnaly use a text editor that handles javascrit much better than eclipse and then do everything with the CLI).
Final warning
If you edit code in eclipse, you will be editing files in platforms/android/assets/www/, not in /www folder.
If you use the cli commands cordova build android or cordova prepare android, the CLI will take the content of the root www folder and put it in platforms/android/assets/www, so all your changes will be lost.
So if you choose to use eclipse to edit javascript/CSS, you will have to choose either save your changes to the root www folder before you use the CLI or stop using the CLI (so if you want to add a plugin you'd have to use plugman).

How to add plugin to PhoneGap?

I'm confused a bit by PhoneGap documentation:
Link 1 // How add plugins using "phonegap local plugin add" command
Link 2 // Tutorial about how to use camera module
Link 3 // PhoneGap Plugins
I've added camera module according (1). But in (2), there is information saying that I should add
<plugin name="Capture" value="org.apache.cordova.Capture"/>
to app/res/xml/plugins.xml and edit app/AndroidManifest.xml files too.
In reference to 3), also there is information that <plugin ... /> construction is obsolete and the developer should use <gap:plugin ... />, instead.
Referencing the latest API documentation:
There are two ways to approach this, first is by using Plugman, and the other is by using CLI. The CLI approach is much simpler.
The Plugman approach:
First, Plugman must be installed. Plugman is the plugin manager used by PhoneGap 3.4. To install Plugman, use the Node JS CLI and enter:
npm install -g plugman
Install the specific plugin using the plugman install command. For example plugman install --platform android --project platforms/android --plugin org.apache.cordova.device-motion. Be sure that the parameter for the --project option points directly to the platform folder, e.g. for Android, that's where the AndroidManifest.xml file is. This command automatically adds all references to the plugins to the pertinent xml files.
Be sure that your HTML file references phonegap.js by the line <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>.
Using CLI:
Go to your app directory and enter the plugin command in the CLI. For example:
phonegap plugin add org.apache.cordova.device-motion
installs the accelerometer plugin.
After the plugin has installed, it automatically updates all config.xml by adding the corresponding <feature> tags. Note that these updates only affect the platform-specific config.xml files. And so, the top-level config.xml file is not affected. You must manually copy and paste the <feature> tags to the top level config.xml. Otherwise, the plugins will be disabled when you run the app using phonegap run platform.
Take note that the corresponding <feature> tags can only be added to the corresponding config.xml files if your project is already ready to deploy in that specific platform.
If you are using phonegap 3.0 the latest as of this answer, you add plugins from the command line like so.
"phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git"
This is supposed to then add all the references to the plugin automatically now.
I have recently installed the AdMob plugin in my project.
To do this :
I opened NODE.js command prompt.
Navigated to the phonegap project.
Then typed this into the cmd : phonegap plugin add cordova-plugin-admobpro
This installed the plugin in the plugins directory in my phonegap project folder.
:)
Since Phonegap 3.0 you need to use 'plugman' to add plugins to a phonegap project.The important part is to set the 'path' to your project in the platform specific project folder created by phonegap. In iOS it would be something like: /Users/user1/Dev/helloworld-phonegap/platforms/ios.
Do the following to install the dialogs plugin for ios.
1) npm install -g plugman
2) plugman install --platform ios --project /path/to/my/platform/folder --plugin org.apache.cordova.dialogs
I
check the docs for more info: http://docs.phonegap.com/en/3.3.0/plugin_ref_plugman.md.html#Using%20Plugman%20to%20Manage%20Plugins

how do i include another project in github

I have created a plugin for a javascript library and want to upload this to github as a new project. Within my plugin directory, i include the current code for the javascript plugin.
So it's easy for users to get my plugin plus the javascript library, i thought i would include the javascript project inside my directory. My intention was not to make changes to the js library but to allow the user to download my project and get the latest version of the js library at the same time.
I could do this manually by forking the js library project into my directory and then syncing it each time a new version comes out but is there a way to do this automatically ?
Check out git submodule, it does exactly what you describe!