From WebOS Internals
Revision as of 05:37, 19 August 2013 by Dkirker (talk | contribs)
Jump to navigation Jump to search


There are a couple of methods for registering an app to handle a particular MIME type or extension, URL scheme, or URL redirect.

I (dkirker), personally recommend the appinfo method, as it applies when your app installs, and is the easiest to maintain.

Both methods can be controlled from within the "Default Apps" scene in the "Device Info" app. (Open the "Device Into" app, select the menu, choose "Default Applications". Some patches provide this in other areas.)


Developers SHOULD ALWAYS open URLs to documents and resources through the system manager, and not by calling an app directly. You can do this by calling:

this.controller.serviceRequest("palm://com.palm.applicationManager", {
  method: "open",
  parameters:  {
      target: "the url or resource that you want to open"

This allows the system to determine the user's preferred application. If you call the applicationManager with the "launch" method, you will be stoned to death with a bag full of Veer's. Just sayin'! ;-)

appinfo.json Method

There is a "mimeTypes" keyword that you can use within your appinfo.json file to auto-register your app. When the system receives a URL or file that your app can handle, your app is launched with a launch parameter "target" set to the location of the file.


"mimeTypes": [
    {"scheme": "maploc"}

LunaSysMgr actually converts this to a URL pattern to a regular expression as follows, and registers that:

"^" + scheme + ":"

So, to register a scheme, just use a value that is the part before the ":" or "://" in a URL.

URL Pattern

"mimeTypes": [
    { "urlPattern": "^https?:" }

The value of "urlPattern" is a regular expression to match against the URL that LunaSysMgr is handling. This is a GREAT way to allow apps for services that have a website (say, Instagram, or Twitter, or Google Maps) to launch the app, instead of the website! At the moment, there are no real methods to change this in the "Default Applications" scene (except for the http/https option in the example above, which is under the "Web" setting).



Luna-bus Method


See: (for use) https://github.com/woce/LunaSysMgr/blob/beta/Src/base/application/ApplicationDescription.cpp#L179 See: (for implementation) https://github.com/woce/LunaSysMgr/blob/beta/Src/base/application/MimeSystem.cpp