O'Reilly logo

Beginning PhoneGap by Thomas Myer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix D

PhoneGap Plug-ins

An entire community of developers has started creating plug-ins for PhoneGap on Android and iOS device platforms. (There are currently no plug-ins yet for Palm and BlackBerry.) The idea behind a plug-in is simple: Create native and JavaScript code solutions that other developers can “plug in” to their projects and, thus, quickly and easily extend PhoneGap’s capabilities.

Currently, all PhoneGap plug-ins are hosted at https://github.com/phonegap/phonegap-plugins, which is shown in Figure D-1.

FIGURE D-1: Site where PhoneGap plug-ins are hosted

image

This appendix summarizes each of the available plug-ins for each platform.

ANDROID PLUG-INS

The following plug-ins are available for Android:

  • Analytics
  • BarcodeScanner
  • BlueTooth
  • ChildBrowser
  • ClipboardManager
  • ContactView
  • FileUploader
  • FtpClient
  • PayPalPlugin
  • PowerManagement
  • Share
  • SoftKeyboard
  • StatusBarNotification
  • TTS
  • WebIntent

Analytics

Use this plug-in to integrate Google analytics with your Android app. It creates a window.plugins.analytics object.

To start, enter the following code:

/**
 * Initialize Google Analytics configuration
 * 
 * @param accountId         The Google Analytics account id 
 * @param successCallback   The success callback
 * @param failureCallback   The error callback
 */
   
  start(accountId, successCallback, failureCallback);

To track a page view, use the following code:

/** * Track a page view on Google Analytics ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required