The Application Manager's open() method can be used to launch viewers for common file types (.pdf, .doc, .jpg, etc.). When opening a file, you are simply calling the Application Manager's open() method on a target of unknown content type. The target can be web or file-based. If the Application Manager cannot determine the content type based on the file extension or http header, it will return an error.
Video and Audio
The built-in webOS media applications can be used to play stream or file-based audio or video content.
The audio player is launched using the Application Manager's open method with a target property of:
- http://[audio file URI]
- https://[audio file URI]
- rtsp://[audio file URI]
- file://[audio file location]
The video player can play or stream video content. Like the audio player, the video player is launched using the Application Manager's open method with a target property of:
- http://[video file URI]
- https://[video file URI]
- rtsp://[video file URI]
- file://[video file location]
Additional features supported by the video player but not the audio player include the ability to specify a title or thumbnail that is displayed while the video is loading.
Palm has not yet released the Command Resource Handler Table, which will have a complete list of all supported video and mime types.
Launching other 3rd party applications
In addition to launching the included core webOS applications you can launch other 3rd party applications if you know their application ids and any required launch parameters. Palm has hinted that eventually webOS will support dynamic registration for resource handlers and broadcast services "to allow you to determine what applications are available and what services they offer at runtime."
If the launched application is already running, it will become maximized and put into the foreground view.
That covers viewers and players. Check back when Palm lifts the NDA on the SDK for the full Command Resource Handler Table which will help you make real decisions about file and application launching in your application.
In our next (Not Quite) Daily Tutorial, we'll check out System Services like location services, connection status, alarms, sounds, power management, system properties and time services! Follow us on Twitter or grab the webOShelp.net RSS feed to stay in the know.
Much of the information in this article was presented in Chapter 8 of Palm webOS by Mitch Allen.