Home > Uncategorized > Sending SMS from Palm Ares in WebOS

Sending SMS from Palm Ares in WebOS

One of my first forrays into using the Palm Ares online IDE for the Palm  pre, is to create an app that can send SMS. So, I created a basic interface, to / from / Message, and Send button.

Attaching an event to the send button is easy, just select the button, go to the events tab, then select onTap. I also named all the labels and text fields properly.

 

The WebOS code then is as follows (much of it is auto-generated, except for the onTap event)

function MainAssistant(argFromPusher) {}

MainAssistant.prototype = {
setup: function() {
Ares.setupSceneAssistant(this);
},
cleanup: function() {
Ares.cleanupSceneAssistant(this);
},
mainTap: function(inSender, event) {

},
button1Tap: function(inSender, event) {

},
btnSendTap: function(inSender, event) {
// Make an Ajax call to FreebieSMS.co.uk
this.$.lblMessage.setLabel(“btnSendTap invoked”);
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4)
{
this.$.lblMessage.setLabel(xmlhttp.responseText);
}
}

var strUrl = “http://www.freebiesms.co.uk/sendsms.asmx/SendSms?”;
strUrl += “FromName=” + this.$.tfFromName.getValue();
strUrl += “&FromNumber=” + this.$.tfFrom.getValue();
strUrl += “&ToNumber=” + this.$.tfTo.getValue();
strUrl += “&Message=Hello+From+ARES”;
strUrl += “&locale=en-GB”;
this.$.lblMessage.setLabel(“strUrl created”);
xmlhttp.open(“GET”,strUrl,true);
xmlhttp.send();
this.$.lblMessage.setLabel(“AJAX called”);
}
};

 

The full project, as it stands can be downloaded from

https://sites.google.com/site/freesmsuk/Home/palm-ares-sms

Once it’s more complete, then I’ll post it on my SMS blog

 

 

Advertisement
Categories: Uncategorized
  1. October 8, 2010 at 8:45 am

    Ok, I’m reading that the AJAX requrst is done more like this:

    new Ajax.Request(“**URL**”, {
    method : “get”,
    parameters : { param1 : value1,
    param2 : value2 },

    onSuccess : function(inTransport) {

    }.bind(this),

    onFailure : function() { /* Squelch failure. */ },

    onException : function() { /* Squelch exception. */ }

    }); // End AJAX request.

    Like

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: