Home > Uncategorized > Running an App from Ares to a real Palm Pre

Running an App from Ares to a real Palm Pre

How cool is this, there is an “easter egg” in the palm pre, if you type upupdowndownleftrightleftrightbastart you enter developer mode

Which allows you run apps direct from Palm ares to the palm pre via a USB cable.

I’ve also updated my app, so that it can run in multiple orientations, has validation, and responds properly once the AJAX call returns…

Palm App store awaits

 

function MainAssistant(argFromPusher) {}

MainAssistant.prototype = {
setup: function() {
Ares.setupSceneAssistant(this);
},
cleanup: function() {
Ares.cleanupSceneAssistant(this);
},
btnSendTap: function(inSender, event) {
// Make an Ajax call to FreebieSMS.co.uk
Mojo.Log.info(“btnSendTap invoked”);
var xref=this;
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState!=4) return;
if (xmlhttp.status != 200)
{
Mojo.Controller.errorDialog(xmlhttp.responseText.split(“\n”)[0]);
Mojo.Log.info(xmlhttp.responseText);
xref.controller.get(‘btnSend’).mojo.deactivate();
// hide spinner
}
if (xmlhttp.status == 200)
{
xref.controller.showAlertDialog({
onChoose: function(value) {},
title: “Success”,
message: “SMS message sent successfully”,
choices:[
{label: “OK”, value:””},
]
});
xref.controller.get(‘btnSend’).mojo.deactivate();
}
}
// Ensure that a Destination is provided
if (this.$.tfTo.getValue().indexOf(“0044”)!=0)
{
Mojo.Controller.errorDialog(“Recipients phone number must start with 0044.”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return false;
}
// Ensure From-Mobile number is international format
if (this.$.tfFrom.getValue().indexOf(“00”)!=0)
{
Mojo.Controller.errorDialog(“Your phone number must begin with an international prefix (0044 for UK).”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return false;
}

// Ensure names are filled in
if (this.$.tfFromName.getValue().length<3 || this.$.tfFromName.getValue().length>11)
{
Mojo.Controller.errorDialog(“Your name must be between 3 and 11 letters long.”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return false;
}

// Ensure message is not blank
if (this.$.tfMessage.getValue().length==0)
{
Mojo.Controller.errorDialog(“Your message is blank. Please type a message in the box provided”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return false;
}

if (this.$.tfFrom.getValue() == this.$.tfTo.getValue())
{
Mojo.Controller.errorDialog(“You cannot send a text to yourself”);
xref.controller.get(‘btnSend’).mojo.deactivate();
return;
}
var strUrl = “http://www.freebiesms.co.uk/sendsms.asmx/SendSms?&#8221;;
strUrl += “FromName=” + this.$.tfFromName.getValue();
strUrl += “&FromNumber=” + this.$.tfFrom.getValue();
strUrl += “&ToNumber=” + this.$.tfTo.getValue();
strUrl += “&Message=” + this.$.tfMessage.getValue();
strUrl += “&locale=en-GB”;
xmlhttp.open(“GET”,strUrl,true);
xmlhttp.send();
// Show waiting spinner
}
};

Advertisements
Categories: Uncategorized
  1. No comments yet.
  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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: