WebOS: register your own app as file handler
This is some info I gathered doing enhancing my app iCalImporter. If you like this info here, you could buy this app to show me your appreciation.
Have you ever tried the menu item “Default Apps” (German: Standardanwendungen) in the App Launcher’s menu? Then you know that apps can register for certain file/mime types. But how to do it isn’t documented yet. According to this forums thread one might expect to get some documentations about it rather soon. Until then, Jay Canuck and the WebOSInternals-Team both using some luna-send commands to perform the file type registration for their applications: Internalz and Preware. Translating this luna-sends into proper service calls was easy and looks like this:
this.controller.serviceRequest("palm://com.palm.applicationManager/", {
method: 'addResourceHandler',
parameters: {
"appId": "de.metaviewsoft.icalimporter",
"extension": "ical",
"mimeType": "text/calendar",
"shouldDownload": true
},
onSuccess: function() {
}.bind(this),
onError: function(e) {
Mojo.Log.error("Error %j",e);
}.bind(this),
onFailure: function(e) {
Mojo.Log.error("Failure %j",e);
}.bind(this)
});
After you registered your app with this call, your app will be called by WebOS whenever such a file is to handle. To handle this call you will need to move your app from a simple stage application into a single or multi stage application which uses an app-controller:
- in your appinfo.json set “noWindow”:true,
- remove the stage-assistant.js from your sources.json and add an app-assistant.js to your app
- in your app-assistant.js you add an handleLaunch function with the launchParams as parameters
The app-assitant.js looks usually like this:
var gblLaunchParams;
var MainStageName = "main";
function AppAssistant (appController) {
}
AppAssistant.prototype.handleLaunch = function(launchParams) {
// Look for an existing main stage by name.
var stageProxy = this.controller.getStageProxy(MainStageName);
var stageController = this.controller.getStageController(MainStageName);
try {
var params = launchParams;//Mojo.getLaunchParameters();
if (typeof(params) == 'object') {
gblLaunchParams = params;
} else {
gblLaunchParams = Object.toJSON(params);
}
} catch (e) {}
if (stageProxy) {
// If the stage exists, just bring it to the front by focusing its window.
// Or, if it is just the proxy, then it is being focused, so exit.
if (stageController) {
stageController.window.focus();
}
stageProxy.delegateToSceneAssistant("importICal");
} else {
// Create a callback function to set up the new main stage
// after it is done loading. It is passed the new stage controller
// as the first parameter.
var pushMainScene = function(stageController) {
stageController.pushScene(MainStageName);
};
var stageArguments = {name: MainStageName, lightweight: true};
// Specify the stage type with the last property.
this.controller.createStageWithCallback(stageArguments, pushMainScene, "card");
}
};
“importICal” is a function in my main-assistant.js which reads the file given in gblLaunchParam.target. If your app isn’t already open you still might be called from WebOS with some launch parameters. That’s why I call importICal also from my main-assistant.js setup method.
When using an app-assistant you need to remember that certain calls to access the sceneController aren’t possible anymore. Use this.controller.serviceRequest or this.controller.stageController.
Email attachments are stored in a non-public path. Reading the file using Ajax-Get-Request doesn’t work and results in this error message:
Not allowed to load local resource: file:///var/luna/data/attachments/bucket
Unwiredben gave then the hint to use PalmGetResource() which does the trick in reading from this path.
At the moment calling this API isn’t allowed yet:
Your App Has Been Rejected[...]The following issues were found:
main-assistant.js: found a call to a non-public service: palm://com.palm.applicationManager/addResourceHandler main-assistant.js: found a call to a non-public service: palm://com.palm.applicationManager/addResourceHandler main-assistant.js: found a call to a non-public service: palm://com.palm.applicationManager/addResourceHandler main-assistant.js: found a call to a non-public service: palm://co m.palm.applicationManager/addResourceHandler
And now to something slightly different: Here is an easy 3 steps walk-through of adding scroll fades to your Mojo scenes.
People who looked at this item also looked at…
Related items
Popularity: 1% [?]
Juli 27, 2010
Posted in: Allgemein
No Comments
MapTool, one more
There is now another great option to create offline maps from various source: Mapc2mapc. You can read here: http://forums.precentral.net/homebrew-apps/220281-maptool-gps-logger-osm-support-more-14.html#post2571144 the post from pitsop about it. Mapc2mapc is available from here: http://www.the-thorns.org.uk/mapping/
This tool was made by John Thorn and he also added OSMtracker support which is compatible with MapTool. Very, very nice
Also I add the current developer version of MapTool for people who like to play with the hottest and newest stuff and the ones who can’t access the official app catalog. Go and grab it from here.
MapTool (380,1 KiB, 16 hits)
People who looked at this item also looked at…
Related items
Popularity: 1% [?]
Juli 26, 2010
Posted in: Allgemein, Developing, Palm
No Comments
MapTool – offline maps on WebOS
Here are some tutorials how to use MapTool and offline maps on your WebOS device:
Here is a thread about my current changes to the build-in calendar. Goal is to render the calendar into a productive tool. Check it out here.
People who looked at this item also looked at…
Related items
Popularity: 9% [?]
Mai 7, 2010
Posted in: Allgemein
No Comments
Have some more details in calendar’s week view #webos
I used the free day today to work on a patch which brings some more details in the calendar’s week view: it shows 2 lines of event subject and a small bell to indicate an enabled alarm for this event. The bell also shows up in the day view. I will try to put some more infos in the month view tomorrow.
The patch worked on my phone using WebOSQuickInstall. Don’t forget to save the following files before applying the patch for later restore:
/usr/palm/applications/com.palm.app.calendar/stylesheets/calendar.css
/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
/usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
Here is the patch file and also a small icon for the integration of agenda (another great homebrew app) into the calendar app. The icon goes into /usr/palm/applications/com.palm.app.calendar/images/menu-icon-agenda.png
How to use WebOsQuickInstall to apply the patch:
* download WOQI and the WebOsDoctor for your OS version
* switch on developer mode on your device
* backup the files from the calendar app (menu: ‘receive files’ and use the pathes mentioned above to store the files locally)
* apply the patch (use the + button and select the calendar.patch file which you extracted from the archive)
* copy the icon using ‘send file’ from menu
Wanna see some screenshots before? 
Btw, here comes something different: my little backup utility for webos. I use it to backup my 3rd party app directory to have a faster restore whenever I need to run the WebOSDoctor on my phone. How to use? Unpack it and copy the little executable to you internal drive and use WOQI or a local terminal app to run it. I guess you will need the developer mode on to have the restore working. Use it on your own risk, etc.
Do you know my latest game for webos? Reserve your place in the worldwide leaderboard:
There is a link to install the game at the
very bottom
People who looked at this item also looked at…
Related items
Popularity: 9% [?]
Mai 1, 2010
Posted in: Allgemein
3 Comments
2TwitMe 1.3c preview #palmos
Here is a preview of the next 2TwitMe version:
http://www.metaviewsoft.de/2TwitMe.prc
History:
——–
1.3c
* added “Send later” to post error alert
* added copy to message view and text preview
* tapping a word in message view copies this word to clipboard
1.3b
* added “Send later” to menu
* unsend Msg is saved on close
* IP addresses cached
* option to set function of left and right key
1.3a
* Added option: Hide scrollbars
* Send to memo
* save list position on app close more reliable
* screen buttons to cycle through accounts
People who looked at this item also looked at…
Related items
Popularity: 5% [?]
April 22, 2010
Tags: 2TwitMe PalmOS Posted in: Allgemein
2 Comments
Sources for offline maps for use with MapTool for #webos
Some more words how to use offline maps in MapTool for webos.
You have 3 main sources:
- JTileDownloader
for tiles created from OpenStreetMap (OSM) data
JTileDownloader 0.5pre (221,0 KiB, 1.146 hits) - PDA TileManager for tiles created from OSM data
- Mobile Atlas Creator for tiles from Google Maps.
For the use of Mobile Atlas Creator read here what user AurelioB wrote about:
If anyone’s interested, you can download tiles from Google Maps using Mobile Atlas Creator
It’s a neat piece of software that lets you download tiles from several sources in different formats. In order for Maptool to see your tiles you must select “OSMTracker file storage” as the output format.
It’s working great for me.
Download the tiles you need and copy them into a folder called .MapTool (the dot is important) on your internal USB drive of your Palm Pre. Select offline as renderer in options in MapTool.
MapTool is available for free from the AppCatalog.
Btw, did you see my cool WebRadio project for WebOS?
People who looked at this item also looked at…
Related items
Popularity: 8% [?]
April 16, 2010
Posted in: Allgemein
One Comment
Developers: Use MapTool to display multiple spots on a map
Just a small how-to for WebOS developers to use the free MapTool app to display several spots on a map. You can sublaunch MapTool from your app and give it a parameter set with a description of the spots you want to show.
MapTool is available from the AppCatalog and the Homebrew repository on Precentral.net. In the time of writing the most current published version is 1.0.1 and is available from Precentral.net. There is a 1.0.2 already submitted to Palm but still pending since a week.
Have a look into the launch parameters and a working example after the break:
People who looked at this item also looked at…
Related items
Popularity: 6% [?]
März 27, 2010
Posted in: Allgemein, Developing, Palm, WintecTool
No Comments
Life moves fast. Don’t miss a thing.
People who looked at this item also looked at…
Related items
Popularity: 5% [?]
März 25, 2010
Posted in: Allgemein
No Comments
Adding a splah screen to your webos app
With 1.4 you will see a instant opening of the application card in the background which might have a splashscreen and a separate icon on it. How is it done? Add this 2 lines to your appinfo.json:
“splashicon”: “icon-256×256.png”,
“splashBackground”:”images/splash-screenshot-default.png”,
That was grabbed right from the calculator app. To see it you will need to restart Luna.
Enjoy,
Henk
People who looked at this item also looked at…
Related items
Popularity: 9% [?]
März 1, 2010
Posted in: Allgemein
One Comment
Duke3D on webos part 2
Ok, now I managed to add some controls (can still be improved) and create a package to submit to webos-internal and put into the preware feed at precentral.net.
Here is another video for you to watch: Duke3D on Palm Pre
And here is the content of the readme with some hints how to use it:
This is a WebOS port of JonoF’s version of Duke Nukem 3D. You will find this version at
http://www.jonof.id.au/
It’s done by Henk “MetaView” Jonas. With help from rwhitby and the SDLQuake port.
You find more in my blog at http://www.metaviewsoft.de/wordpress or follow me on twitter: @metaview
You need the following files in the Duke3D directory on your internal drive:
DEFS.CON
DUKE3D.GRP
GAME.CON
USER.CONWhen you start Duke3D for the first time, it will create this directory for you.
Controls:
Move and Rotate:
—————-W S Z(Y)
A
or left screen areaFire:
—–Return, J
or right screen areaStrafe left/right:
——————H, N
Jump: B
Open: Space
Run: Shift
Crouch: U
Inventory: I
MedKit: K
TurnAround: BackSpace
SendMessage: P
Map: M
Quick_Kick: L
Next_Weapon: back gesture
Previous_Weapon: forward gesture
Show_Console: O
Menu: Q
Switch keyboard between action and normal mode: @
If you like it and want to do me a favor check out my other apps for webos here and buy a copy of Match This! Pro or Wikay or the Pro-version of TravelGuide (when released):
Match This!
Match This! Pro
Wikay
TravelGuide Light
MapTool
Enjoy,
Henk
People who looked at this item also looked at…
Related items
Popularity: 9% [?]
Februar 28, 2010
Posted in: Allgemein
No Comments
