DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Related

  • Cordova: Communicating Between JavaScript and Java
  • Ionic App Development Over Other Frameworks: Is It Hyped?
  • How to Develop a Simple Step Counter App on ReactNative
  • 12 Frameworks Java, Web, and Mobile Programmers Can Learn in 2018

Trending

  • Spring Authentication With MetaMask
  • How to Configure Istio, Prometheus and Grafana for Monitoring
  • A Better Web3 Experience: Account Abstraction From Flow (Part 1)
  • Adopting Agile Practices for Workforce Management: Benefits, Challenges, and Practices
  1. DZone
  2. Coding
  3. Frameworks
  4. Phonegap 3.0 Released

Phonegap 3.0 Released

Raymond Camden user avatar by
Raymond Camden
·
Jul. 20, 13 · Interview
Like (0)
Save
Tweet
Share
3.98K Views

Join the DZone community and get the full member experience.

Join For Free

Today at PhoneGap Day version 3.0 was released. This is a pretty significant release in terms of the underlying architecture and there are some things you should know.

First - let's start with a few links you should read:

Adobe PhoneGap 3.0 Released
What's New in Cordova iOS 3
Introducing Cordova 3 for Android

Second - there is a new command line tool you will use (or can use I should say, the cordova-cli still works), phonegap. The installation for this is rather trivial if you've got npm already installed:

 sudo npm install -g phonegap

This may seem obvious, but phonegap cli is different from cordova cli. Be sure to use the built-in help and sniff around a bit so you see how it does things compared to cordova. This shouldn't take more than a few minutes and you will probably trip up a few times. Thank you, muscle memory.

One of the coolest aspects of the new command line though is that it fully supports PhoneGap Build. What this means is that you can use the command line to builds via your terminal with and without the SDKs. Or heck, even if you do have the SDKs and want to use PhoneGap Build, the new PhoneGap cli makes this trivial.

Another useful feature is that if you run phongap as is, you get a quick checklist of what SDKs/platforms you can use locally:

OK - READ THIS CAREFULLY

This is the number one thing that I think will trip people up. One of the new things in PhoneGap 3 is a revised plugin architecture. All of the previously core features, like the Camera for example, are plugin based.

When I realized this, my first question was whether a virgin project would include support for the core stuff and expect developers to strip things out (if they cared) or if you would need to implicitly add in support for what you want to use.

Turns out - you need to add in what you want to use. What does that mean practically? As an example, if you try to use navigator.camera.getPicture it will fail with the "out of the box" project made at the command line.

To fix this you can add in the plugin of course. This takes two seconds and can be done via the CLI. This may not be very clear via the docs. First, the command line docs do talk about the core features as plugins and give you the commands to use... but for cordova, not phonegap.

So as an example, this is the cordova way to add the plugin: cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git

And this is how you would do it via phonegap: phonegap local plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git

The net result is that when you start your PhoneGap project, you will want to think ahead of time about the features you need - the previously "just there" features - and add them via the CLI. (As an FYI, it is super easy to remove these plugins too. So if you added the Camera and realize you don't need it, you can quickly remove it.)

For a full list of these plugins, see below. I copied this directly from the link above, so it may change, so please see the link for the most up to date version. And in case it isn't obvious, the $ means the command prompt, not jQuery. ;)

Basic device information:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device.git

Network and battery status:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-network-information.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-battery-status.git

Accelerometer, compass, and geolocation:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-motion.git 
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-device-orientation.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git

Camera, media capture, and media playback:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-camera.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media-capture.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git

Access files on device or network:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-file-transfer.git

Notifications via dialog box or vibration:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-dialogs.git
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-vibration.git

Contacts:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-contacts.git

Globalization:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-globalization.git

Splash Screen:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-splashscreen.git

In-app browser:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-inappbrowser.git

Debug console:
$ cordova plugin add https://git-wip-us.apache.org/repos/asf/cordova-plugin-console.git

p.s. I've not no idea what the plugin console is. Going to research.

Apache Cordova

Published at DZone with permission of Raymond Camden, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • Cordova: Communicating Between JavaScript and Java
  • Ionic App Development Over Other Frameworks: Is It Hyped?
  • How to Develop a Simple Step Counter App on ReactNative
  • 12 Frameworks Java, Web, and Mobile Programmers Can Learn in 2018

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: