PhoneGap webOS Updates

1 BY markus

With Version 1.6.0, PhoneGap for webOS now supports the compass sensor found in the HP TouchPad. The initial work to enable the functionality in Phonegap was done by Markus Leutwyler, a webOS Developer Relations team member, and HP officially contributed to the project.

PhoneGap is an HTML5 app platform that allows you to author native applications with web technologies and get access to APIs and app stores. PhoneGap on webOS allows cross-platform developers to code for one API for device functions such as accelerometer, compass and geolocation while PhoneGap takes care of calling the webOS specific implementations.

Here is how you can receive a current compass heading with PhoneGap:

function onSuccess(heading) {
  alert('Heading: ' + heading.magneticHeading);
};

function onError(error) {
  alert('CompassError: ' + error.code);
};

navigator.compass.getCurrentHeading(onSuccess, onError);

Check out the source code of compass.js to see how we enabled the functionality.

We also updated the API documentation to not only include the new compass functionality but also specify which other device specific APIs can be used on webOS. The current version of the documentation is on github and will be incorporated into the next release of PhoneGap.

 

Comment (1)

  1. Eric Blade says:

    Cheers for that updated documentation — parts of the documentation would say it supported webOS for some things, but when you opened the full docs, it wouldn’t.

    On the connection documentation — can the webOS quirk be noted to say what the return value actually is, rather than that it just returns that there is a connection?

    Great to see some updates there :) Thanks!