HackathonCrossApp
From WebOS101
Relego Cross App Launch
Relego has a cross-app launch option to pass along a URL and Title (optional) in order to save it for later reading.
Relego Accepts 3 Parameters:
action = addtorelego [required] url = The full URL to save. [required] title = The title/descriptive name. [optional]
Cross App Launch Code
You can use the code below in your app to send URLs to Relego. Replace this.currentUrl with the URL to save. this.currentTitle is the descriptive name or title of the page being saved (Optional, but recommended). You can add your own code for an onSuccess method.
try{
this.controller.serviceRequest("palm://com.palm.applicationManager", {
method: 'open',
parameters: {
id: "com.webosroundup.relego",
params: {action: 'addtorelego', url: this.currentUrl, title: this.currentTitle}
},
onFailure:function(){
//--> Relego is not installed, so offer the ability to download
this.controller.showAlertDialog({
onChoose: function(value){
if (value=="yes"){
//--> And weee'rrre.. off to see the wizard
this.controller.serviceRequest('palm://com.palm.applicationManager', {
method:'open',
parameters:{
target: "http://developer.palm.com/appredirect/?packageid=com.webosroundup.relego"
}
});
}
},
preventCancel: false,
title: $L("Relego Not Installed"),
message: $L("Relego is not installed. Would you like to download it? It's Free!"),
choices:[
{label:$L("Yes"), value:"yes", type:"affirmative"},
{label:$L("No"), value:"no", type:"dismissal"}
]
});
}.bind(this)
})
}catch(e){
Mojo.Log.error("Relego Launch Error: " + e);
}
Browser Patch
As an added benefit, there is a patch for the browser on your device. This will allow you to send any webpage directly to Relego.
http://www.jeharrisonline.com/palm/files/relego-patch-v1.zip
The patch has been submitted to the webOS Internals feeds. It is currently compatible for webOS 1.4.5 and should appear shortly. The link above is for installing the patch manually in the interim, just use webOS Quick Install.
