Learn More





DNN Community Blog

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.

Accelerating Mobile Application Development

Pulse1This article is cross-posted from my personal blog.


In preparation for the upcoming DotNetNuke Hackathon in St. Louis, I have been busy working on a new mobile application for the Android and iPhone platforms.  Nik Kalyani and I have been playing with the Appcelerator Titanium product for the past several months and have been intrigued by it’s promise to allow you to quickly develop mobile applications for multiple platforms using the coding skills that many web developers already possess.  When Nik started planning for the St. Louis Hackathon he decided to focus on building apps which bridge the mobile and DotNetNuke space.  He immediately thought that Appcelerator was a natural tool to use.

What attracted Nik and I to Titanium was the ability to program in JavaScript with a light sprinkling of HTML and CSS to create native iPhone and Android applications.  It also helped that Titanium is an Open Source product which is a big plus for the DotNetNuke community.  The real Titanium magic happens when you compile your application using Titanium Developer.  At that point a native application is generated for either Android or iPhone, and coming soon the BlackBerry as well.  Titanium Developer lets you run your app on the various platform emulators as well as allowing you to push your application directly to a physical device.  As a final step, Titanium Developer even assists with publishing your finished application to the Android Market and the iPhone App store.

When we started planning for the St. Louis Hackathon event we wanted to be able to provide some ideas for applications that Hackathon participants could build.  We also wanted to find a nice simple mobile application that we could build prior to the event to help people get up to speed before the Hackathon kickoff.  Our original idea for our sample app was to create a user group application which would help people find user groups in their area.  We thought that this application had the ability for us to showcase many of the really sexy features of mobile development like XmlHttpRequests, geolocation and mapping – all of which are available within Titanium.

Like all good developers without a project manager around, we were able to quickly blow up the scope until we actually ended up with a rather full featured community application.  Over the coming week I’ll be showcasing much of the code from the User Group portion of the application with the intention of showing off the complete application at the Hackathon.   Chris Hammond discusses how to get started with Appcelerator Titanium and  will have additional posts about mobile development and Appcelerator during this time as well so that hopefully by the time the Hackathon starts people are able to hit the ground running.

My posts over the coming week are an opportunity to help you avoid some of the pitfalls of developing mobile applications with Appcelerator.  Like every development platform, the correct approach is not always obvious and can often require a lot of effort to figure out.  I hope that by showing you some of my own hard learned lessons that you can experience more of the joy of mobile development and less of the pain.  Most programmers I know love that first time feeling of successfully completing a project on a new platform and I hope that with a little guidance you can be up and running quickly with your own mobile application that works well with your DotNetNuke website or module.

Using Webservices

During development of our sample application, I ran into a number of areas  where I had to dig into the documentation and figure out how things actually worked.  Titanium has pretty decent documentation, but because of the rapid pace of change in the platform, it is not always up to date, or does not reflect bugs in the platform which prevent it from working as documented.  As I cover different aspects of development I’ll try to point out some pitfalls which will help smooth out your development experience and minimize your learning curve.  If all else fails though you can always post a question in their Q&A forums.

One of the first tasks I had to figure out was how to call webservices using Titanium.  Using the Mobile API Reference and their KitchenSink sample application I was able to quickly determine that calling webservices was very similar to using the AJAX methods in jQuery.  The KitchenSink sample includes the following code for making a webservice call.

var xhr = Titanium.Network.createHTTPClient();

xhr.onload = function()
	var doc = this.responseXML.documentElement;
	var elements = doc.getElementsByTagName("screen_name");
	var screenName = elements.item(0);
	var screenname = Ti.UI.createLabel({
	var textarea = Ti.UI.createTextArea({
	textarea.value = this.responseText;
// open the client'GET','');

// send the data

As you can see, this is not so complicated.  It is mostly creating an XHR object, opening the request, sending the data and then waiting for the return call to occur in the onload event.  It’s not quite as clean as the jQuery implementation, but it is workable.  Where things start to get a little tricky is when you want to send data to a webservice using a Post request.   Looking at the API it seems that it should be as simple as creating an object and passing that object in the xhr.send() method:'POST','');

var data = {
	lat: '37.549528',
	lng: '-122.316826', 
	radius: 50


Unfortunately, this did not seem to work and always generated errors on the server.  The problem turned out to be one that bites a lot of people doing webservice calls with JavaScript, whether they are using Titanium or jQuery.  Dave Ward posted a really good blog post which explains the problem.  The bottom line is that I needed to send my data as a string and not as an object.  Regardless of what the Titanium documentation says, if you try to send the data as an object you will get an error.  Once I figured this out.  Everything started working and I was able to move forward.  Unfortunately for me my Bing skills were failing me that day and I wasted many hours on this silly little problem.  Now that I have pointed it out you should be able to avoid it in your own apps.

Of course this is just the tip of the iceberg when developing mobile apps which talk to webservices.  You will want to make sure that you include error handling since you never know when someone might hold their phone incorrectly and drop the data connection.   The Titanium HTTPClient allows you to hook up the onerror, ondatastream, onreadystatechange, onsendstream and onload functions.  Using these functions provides you with plenty of visibility of what is happening with any individual request.  I definitely recommend looking through the various XHR examples provided in the KitchenSink sample app.


There are currently no comments, be the first to post one.

Comment Form

Only registered users may post comments.


2sic Daniel Mettler (124)
Aderson Oliveira (15)
Alec Whittington (11)
Alex Shirley (10)
Andrew Nurse (30)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (21)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (203)
Chris Paterra (55)
Clinton Patterson (28)
Cuong Dang (21)
Daniel Bartholomew (2)
Dave Buckner (2)
David Poindexter (3)
David Rodriguez (2)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (74)
Geoff Barlow (6)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (269)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matthias Schlomann (15)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Mike Horton (19)
Mitchel Sellers (28)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Peter Donker (52)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott S (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Timo Breumelhof (24)
Tony Henrich (3)
Torsten Weggen (2)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (37)
Will Strohl (163)
William Severance (5)
Try Evoq
For Free
Start Free Trial
a Demo
See Evoq Live
Need More Information?