The Hybrid Web Container comes with the PhoneGap library linked in and ready to use.
The PhoneGap library included with Sybase Unwired Platform handles common native tasks supported by Android, BlackBerry, iOS and Windows Mobile devices, for example, accessing geolocation, accessing contacts, and invoking calls to make those common functions available to JavaScript.
You can make PhoneGap calls from the Hybrid Web Container JavaScript, such as Custom.js. For example, to save an entry to the contacts database, you can implement something similar to:
var contact = navigator.contacts.create(); contact.nickname = "Plumber"; var name = new ContactName(); name.givenName = "Jane"; name.familyName = "Doe"; contact.name = name; // save contact.save(onSaveSuccess,onSaveError);
You can use both Hybrid Web Container JavaScript APIs and PhoneGap APIs in a single application. For information about PhoneGap APIs, see http://docs.phonegap.com.
API | Object and Function | Platform |
---|---|---|
Accelerometer | ||
accelerometer
|
|
|
Acceleration
|
|
|
Camera | ||
Camera
|
|
|
CameraOptions
|
|
|
Capture | ||
Capture
|
|
|
MediaFile
|
|
|
Compass | ||
compass
|
|
|
compass.Heading
|
|
|
Connection | ||
network.connection.type |
|
|
Contacts | ||
contacts.create |
|
|
contacts.find |
|
|
contact.clone |
|
|
Contacts.remove Note: On Android, there is an issue with contacts not
being fully removed. See https://issues.apache.org/jira/browse/CB-75.
|
|
|
Contacts.save |
|
|
Device | ||
Device.name |
|
|
Device.phonegap |
|
|
Device.platform |
|
|
Device.uuid |
|
|
Device.version |
|
|
Events | ||
Deviceready |
|
|
Pause |
|
|
Resume |
|
|
Online |
|
|
Offline |
|
|
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 |
|
|
Searchbutton |
|
|
File | ||
DirectoryEntry
|
|
|
FileEntry
|
|
|
FileReader
|
|
|
FileWriter
|
|
|
DirectoryReader
|
|
|
LocalFileSystem
|
|
|
FileTransfer
|
|
|
Geolocation | ||
geolocation
|
|
|
Position
|
|
|
Coordinates
|
|
|
Media | ||
Media.play |
|
|
Media.pause |
|
|
Media.stop |
|
|
Media.release |
|
|
Media.record |
|
|
Media.startRecord |
|
|
Media.stopRecord |
|
|
Media.getCurrentPosition |
|
|
Media.seekTo |
|
|
Media.getDuration Note: On Android, this function returns a value
without an error but always returns -1, which indicates duration is
not available.
|
|
|
Notification | ||
Notification.beep |
|
|
Notification.confirm |
|
|
Notification.alert |
|
|
Notification.vibrate |
|
|
Storage | ||
window
|
|
|
Database
|
|
|
SQLTransaction
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); |
|
|
SQLResultSet
|
|
|
SQLResultSetList
|
|
|
SQLError
|
|
|
localStorage
|
iOS |