PhoneGap Support

PhoneGap is an open source framework that leverages Web technologies such as HTML and JavaScript to access native (system and third-party) functionality across platforms.

Sybase Unwired Platform comes with PhoneGap 1.4.1 libraries, which handle common tasks supported by most devices, linked in and ready to use. Integrating PhoneGap plug-ins with Hybrid Web Containers allows you to extend the set of APIs available within a Mobile Workflow application. See www.phonegap.com for information about the supported PhoneGap APIs.

You can use both Hybrid Web Container JavaScript APIs and PhoneGap APIs in a single Workflow application.

PhoneGap Supported Features
API Object and Function Platform
Accelerometer    
  accelerometer
  • getCurrentAcceleration
    Note: On iOS, this function must be called after watchAcceleration.
  • watchAcceleration
  • clearWatch
  • Android
  • iOS
  Acceleration
  • x
  • y
  • z
  • timeStamp
  • Android
  • iOS
Camera    
  Camera
  • getPicture (Camera.PictureSourceType.CAMERA)
  • getPicture (Camera.PictureSourceType.PHOTOLIBRARY)
  • getPicture (Camera.PictureSourceType.SAVEDPHOTOALBUM)
  • Android
  • iOS
CameraOptions
  • quality
  • dedestinationType.DATA_URL
  • dedestinationType.FILE_URI

    FILE_URI is the default.

  • allowEdit
  • encodingType
  • targetWidth
  • targetHeight
  • Android
  • iOS
Capture    
  Capture
  • captureAudio
    Note: On Android, whether this works depends on which application the device uses to record the audio. You can use media.record instead to work around this issue.
  • captureImage
  • captureVideo
  • Android
  • iOS
MediaFile
  • getFormatData
  • Android
  • iOS
Compass    
  compass
  • getCurrentHeading
  • watchHeading
  • clearWatch
  • watchHeadingFilter
  • Android
  • iOS
Compass.Heading
  • magneticHeading
  • trueHeading
  • headingAccuracy
  • timestamp
  • Android
  • iOS
Connection    
  network.connection.type
  • Android
  • iOS
Contacts    
  Contacts.create
  • Android
  • iOS
  Contacts.find
  • Android
  • iOS
  Contact.clone
  • Android
  • iOS
  Contacts.remove
Note: On Android, there is an issue with contacts not being fully removed. See https://issues.apache.org/jira/browse/CB-75.
  • Android
  • iOS
  Contacts.save
  • Android
  • iOS
Device    
  Device.name
  • Android
  • iOS
  Device.phonegap
  • Android
  • iOS
  Device.platform
  • Android
  • iOS
  Device.uuid
  • Android
  • iOS
  Device.version
  • Android
  • iOS
Events    
  Deviceready
  • Android
  • iOS
  Pause
  • Android
  Resume
  • Android
  Online
  • Android
  • iOS
  Offline
  • Android
  • iOS
  Batterycritical iOS
  Batterylow iOS
  Batterystatus
Note: On Android, PhoneGap 1.4.1, this does not work due to a known issue. See https://issues.apache.org/jira/browse/CB-173.
iOS
  Menubutton
  • Android
  Searchbutton
  • Android
File    
  DirectoryEntry
  • copyTo
  • moveTo
  • toURI
  • remove
  • removeRecursively
  • getParent
  • createReader
  • getDirectory
  • getFile
  • Android
  • iOS
  FileEntry
  • copyTo
  • moveTo
  • toURI
  • remove
  • getParent
  • createWriter
  • file
  • Android
  • iOS
  FileReader
  • abort
  • readAsDataURL
  • readAsText
  • Android
  • iOS
  FileWriter
  • abort
  • seek
  • truncate
  • write
  • Android
  • iOS
  DirectoryReader
  • readEntries
  • Android
  • iOS
  LocalFileSystem
  • requestFileSystem
  • resolveLocalFileSystemURI
  • Android
  • iOS
  FileTransfer
  • upload
  • download
  • Android
  • iOS
Geolocation    
  geolocation
  • getCurrentPosition
    Note: This function does not work on the Android Galaxy Tab P1000 device.
  • watchPosition
  • clearWatch
  • Android
  • iOS
  Position
  • coords
  • timestamp
  • Android
  • iOS
  Coordinates
  • latitude
  • longitude
  • altitude
  • accuracy
    Note: On Android, the returned accuracy property is always null.
  • altitudeAccuracy
    Note: On Android, the returned altitudeAccuracy property is always null.
  • heading
    Note: Android only. The returned heading property is always null.
  • speed
    Note: On Android, the returned speed property is always null.
  • Android
  • iOS
Media    
  Media.play
  • Android
  • iOS
Media.pause
  • Android
  • iOS
Media.stop
  • Android
  • iOS
Media.release
  • Android
  • iOS
Media.record
  • Android
  • iOS
Media.startRecord
  • Android
  • iOS
Media.stopRecord
  • Android
  • iOS
Media.getCurrentPosition
  • Android
  • iOS
Media.seekTo
  • Android
  • iOS
Media.getDuration
Note: On Android, this function returns a value without an error but always returns -1, which indicates duration is not available.
  • Android
  • iOS
Notification    
  Notification.beep
  • Android
  • iOS
Notification.confirm
  • Android
  • iOS
Notification.alert
  • Android
  • iOS
Notification.vibrate
  • Android
  • iOS
Storage    
  window
  • OpenDatabase
  • Android
  • iOS
Database
  • transaction
  • Android
  • iOS
SQLTransaction
  • executeSQL
Note: On Android, queries on the first database created do not work. You can work around this by creating and opening two databases, the first of which can have the size of 0, and the second to use as you normally do. For example:
var db = window.openDatabase("aName1", "1.0", "aName1", 0);
db = window.openDatabase("aName2", "1.0", "aName2", 200000);
  • Android
  • iOS
SQLResultSet
  • insertid
  • rowAffected
    Note: The returned SQLResultSet object does not contain a rowAffected property, as the PhoneGap API states. Instead, use rowsAffected.
  • rows
  • Android
  • iOS
SQLResultSetList
  • item
  • length
  • Android
  • iOS
SQLError
  • code
  • message
  • Android
  • iOS
localStorage
  • key
  • getitem
  • setitem
  • removeitem
  • clear
iOS
Related reference
Public JavaScript Functions