Continuing with my explorations in the webOS 1.4.5 SDK, I’ve picked out a couple of other useful calls to the PalmSystem object. Both can be added to the “hello world” example I started in part one, and they’re really quick.
A common requirement for mobile apps is the ability to respond to device orientation. I’m still digging around to see where you can hook into these events, but in the meantime here’s a simple call which is quite useful:
This tells webOS to let your app rotate along with the device orientation, switching from portrait to landscape as necessary. It’s a high-value one-liner call which should serve most orientation needs.
You can also specify a “locked” orientation with different strings in place of “free”. Options are: up (default portrait), down, left and right. So if you have a side-scroller game that would benefit from horizontal presentation, just use:
Pretty cool, and definitely useful in our quest to turn web apps into webOS apps without having to load Mojo.
Full screen mode
Speaking of games, sometimes you want all the screen real-estate you can get, and those extra 30px or so which have your app menu, current time, battery and signal strength look mighty delicious. Here’s how to toggle that on or off, revealing a full empty screen to create your masterpiece:
Toggle the full screen mode by passing in either true or false.
A word of caution
Keep in mind that there is a reason Palm abstracts this stuff into the Mojo SDK, and there is no guarantee (yet) of how long these calls will be around. It’s always best to keep a close eye on the Palm Developer Forums and test your apps extensively with any upcoming version of webOS.
I want to get a working example of a low-level webOS service request. This interface allows you to get to important system calls to dial a phone number, get your GPS location, launch another app and other neat stuff.