OUTDATED: This was a draft spec. Check the Mobile-Spec instead for ongoing work
See javascripts/docs/files.html in your source tree for the latest & more detail.
Example: http://github.com/NachoMan/phonegap/tree/d069cb74acd8052d408f9ac00ece9956d18b726e/javascripts
Geolocation
Geolocation class
readonly attribute Position lastPosition
void getCurrentPosition(successCallback, [errorCallback], [options])
int watchPosition(successCallback, [errorCallback], [options])
void clearWatch(int watchId)
boolean getPermission([siteName], [imageUrl], [extraMessage])
Position class
readonly attribute double latitude
readonly attribute double longitude
readonly attribute double accuracy
readonly attribute double altitude
readonly attribute double altitudeAccuracy
readonly attribute Date timestamp
readonly attribute Address gearsAddress
PositionOptions class
readwrite attribute bool enableHighAccuracy
readwrite attribute bool gearsRequestAddress
readwrite attribute string gearsAddressLanguage
readwrite attribute string[] gearsLocationProviderUrls
PositionError class
readonly attribute int code
readonly attribute string message
Address class
readonly attribute string streetNumber
readonly attribute string street
readonly attribute string premises
readonly attribute string city
readonly attribute string county
readonly attribute string region
readonly attribute string country
readonly attribute string countryCode
readonly attribute string postalCode
Accelerometer
Accelerometer class
readonly attribute Position lastPosition
void getCurrentAcceleration(successCallback, [errorCallback], [options])
int watchAcceleration(successCallback, [errorCallback], [options])
void clearWatch(int watchId)
Camera
Camera class
void getPicture(successCallback, [errorCallback], [options])
int getPictureFromLibrary(successCallback, [errorCallback], [options])
Notification
Notification class
void beep()
void vibrate()
void blink()
void watchPosition(filter, [successCallback], [errorCallback])
void clearWatch(filter, [successCallback], [errorCallback])
void onReceive(successCallback, errorCallback)
Contacts
Contacts class
void getAllContacts(successCallback, [errorCallback], [options])
Contact class
readonly attribute String name
readonly attribute String[] phone
readonly attribute String address
File IO
File class
void read(fileName, [successCallback], [errorCallback])
void write(fileName, data, mode, [successCallback], [errorCallback])
void createDirectory(directory, [successCallback], [errorCallback])
void deleteDirectory(directory, [successCallback], [errorCallback])
boolean testDirectoryExists(directory, [successCallback], [errorCallback])
void deleteFile(file, [successCallback], [errorCallback])
boolean testFileExists(file, [successCallback], [errorCallback])
long getFreeDiskSpace([successCallback], [errorCallback])
SMS
SMS class
void send(number, message, [successCallback], [errorCallback])
Phone
Phone class
void call(number, [successCallback], [errorCallback])
Maps
Map class
void open(positions, [successCallback], [errorCallback])
Audio
Audio class
void startRecording(file, encoding, successCallback, [errorCallback])
void stopRecording(successCallback, [errorCallback])
void startPlaying(filename, channel, successCallback, [errorCallback])
void stopPlaying(channel, successCallback, [errorCallback])
long getDuration(filename, successCallback, [errorCallback])
long getCurrentPosition(filename, successCallback, [errorCallback])
void setOutputDevice(device, successCallback, [errorCallback])
string getOutputDevice(successCallback, [errorCallback])
Settings
Settings class
string getNetworkOperatorName([successCallback], [errorCallback])
string getVoicemailNumber([successCallback], [errorCallback])
string getTimeZoneID([successCallback], [errorCallback])
string getSimCountryIso([successCallback], [errorCallback])
string getLine1Number([successCallback], [errorCallback])
HTTP
HTTP class
void get(url, file, channel, successCallback, [errorCallback])
Comments (11)
mboehmer said
at 4:57 pm on Jan 3, 2009
How close is this API to the draft of the W3C Location API?
Dave Johnson said
at 11:25 am on Jan 4, 2009
The geo stuff is going to be exactly like that of the W3C geo API. Everything else is loosely modeled on that same pattern.
Pete Strickler said
at 11:56 am on Jan 19, 2009
Am I correct in believing that the File IO section has not been implemented yet? (Specifically on iPhone)
Is this something that is being worked on? Or is it just a dream at the moment?
Pete Strickler said
at 3:13 pm on Jan 19, 2009
Never mind, I did figure out how to store and load local file data using SQLite in Javascript. I'll try to write a short tutorial on that shortly... :-)
smilbandit said
at 7:06 am on Apr 3, 2009
Anyone know an example using the get function of the http class?
pb said
at 6:32 am on Apr 20, 2009
Let's assume, MobileSafari would get W3C compatible with OS 3.0 for sound and geolocation - would code developed for PhoneGap be compatible with that MobileSafari implementation?
hari said
at 1:24 pm on Apr 30, 2009
Is it possible to retrieve "deviceID" i.e aUNIQUE identification number for the this particular device ( iPhone) and or Android. Thanks
hari said
at 1:28 pm on Apr 30, 2009
ALSO ... you guys are the best.. I spent several hours learning(well..trying to learn) Objective-C. This saves me a lot of time.
Zach said
at 7:30 pm on May 7, 2009
As far as I can tell, the HTTP class doesn't have a JS interface implemented yet.
Joel said
at 8:56 pm on Sep 3, 2009
Pardon my ignorance, but if the class is "Accelerometer" (capital 'A') and the method is "watchAccelerometer" why is the call in the sample code read "timer = navigator.accelerometer.watchAcceleration(suc,fail,opt);"??
Is this documentation out of date?
Dave Johnson said
at 2:00 pm on Sep 7, 2009
@Joel yes it is watchAcceleration - updated it on the wiki now!
You don't have permission to comment on this page.