www.webOShelp.net

Get the latest on:webOS Developers' RSS FeedwebOS Facebook page webOS Twitter Feed

Home Tutorials
webOS Tutorials

Launching Viewers, Players and other 3rd party applications

Viewing files

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.

Click here for an example of opening a file using the Application Manager.

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]

Click here for an example of launching the Audio player with a local file.

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.

Click here for an example of launching the Video player with a local file.

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.

Click here for an example of launching a 3rd party application.

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 www.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.

 

0 Comments

Palm Synergy Services

It has been many days since our last (Not Quite) Daily Tutorial. But we're back with Palm Synergy Services; a very cool feature that allows you to do some neat tricks with applications, such as automatically inserting an event in your calendar after you've performed an action like making a dinner reservation or buying tickets for a concert. Palm Synergy Services support integration with the Synergy applications which currently include Contacts, Calendar, Email and Messaging. Palm suggests that other applications "could be supported over time", which leaves hope for integration with other apps like Tasks and Memos.

Email and Messaging are launched through the Application Manager service and can be used to send messages with the user's approval, similar to the way the Phone application works (the application launches with information provided from the calling application, but the user must still press "send"). Contacts and Calendar services enable applications to work more directly with contact data or calendar events, although Palm suggests these services are designed for "occasional use" to add single records rather than "full sync" solutions.

Account Manager

Operations that add data to Synergy applications (e.g. adding an event to a user's calendar) require an established Synergy Account before any other operations can take place. There is an implicit "Palm" account that all information created and stored on the device belongs to, but other information must be provided by an application with an explicit account id. Data that belongs to an account can only be accessed by the application that owns that account.

A good example of this is the third-party�Missing Sync�application. It enables you to pull data from iCal on a Mac into the Palm's calendar application (among other things). To do this, the Missing Sync application creates its own calendar "account", which is then listed when you go into the calendar application on the Pre (it's the last one with the markspace@markspace.com email):

synergy calendar accounts

Read more...
 

0 Comments

Mojo Application Services

The Application Manager is a specific service that provides all application services to Mojo applications. Application services are services that involve launching other applications, whether they be core webOS applications or other third party applications.

The application manager, through one or both of its service methods Open and Launch, provides access to most of the application services. We'll look at each of these in more detail.

Open

This method is best used to display content when you don't know the specified type of content or best application available to handle it. In this case, the application manager will automatically launch the application most appropriate for that content type. This method accepts a single argument, a formatted URI for the content to display. The mime type of the referenced URI is used to identify the appropriate application to launch to handle the content indicated.

Read more...
 

1 Comment

Introduction to Mojo Services

Services enable access to low-level hardware hardware capabilities such as GPS and acceelerometer data, and higher-level data services such as Palm Synergy, cloud services, and any other web service APIs.

Services can be divided into the following groups:

  • Application services, which include
    • Core application services
    • Palm Synergy Services
    • Viewers & Players
    • Third-party Applications
  • System services, which include
    • Alarms
    • Connection Manager
    • Location Services (including GPS)
    • Power Management
    • System Properties
    • System Settings
    • System Sounds
  • Cloud servivces, which includes
    • Mojo Messaging
    • [Palm implies additional services will be offered later]

Most Application services will launch an application in its own card and will not return automatically to the calling application. System and Cloud services typically return some data to the calling application through one or more calls to a callback function that is defined in the calling application.

All Mojo service calls are asynchronous, meaning that you must define a callback function to receive the data returned from the service request.

There are some constraints to using services in applications that are not in the foreground that Palm has not yet revealed (will come in Chapter 10). Briefly, in many cases the application should limit or stop service requests altogether when it is minimized or in the background.

Read more...
 

1 Comment

webOS and AJAX - Revisited

We covered some of the possibilities for Ajax in webOS applications in our first webOS and AJAX tutorial. Mitch Allen also covers this topic at the end of chapter 6 of Palm webOS. This article revisits Ajax usage in webOS from Palm's perspective.

First of all, Palm explains that there are multiple ways to implement AJAX in webOS applications:

  • Using the Ajax class functions of the Prototype JavaScript framework.
    • Use this method for simple functions that encapsulate the lifecycle of an XMLHttpRequest object and handlers.
    • Works with simple XML, JSON or text-based web services.
  • Using the native JavaScript XMLHttpRequest object directly
    • Use this method if your data protocols are SOAP based or anything other than the data types listed above.

Palm covers only the Prototype methods in this chapter. To learn about using the native JavaScript XMLHttpRequest object for AJAX transfers, see our other article AJAX and webOS.

Ajax.Request

The Ajax.Request object manages the complete Ajax lifecycle and allows you to define callbacks at various points to insert processing within the lifecycle where your application requires it. Ajax requests are asynchronous by default, but this behavior can be overridden if necessary. (Synchronous transfers with XMLHttpRequest (the native JavaScript JavaScript object) are currently disabled in webOS. Currently, "the UI and applications run as part of a common process", so Palm says it's "necessary to preserve UI responsiveness".)

Here's an example of Ajax.Request in use:

Read more...
 

0 Comments



Page 2 of 7