Locatrix Communications

Behind The Scenes: Salamander

April 23rd, 2009 by Sam Collins

Most developers writing web applications for mobile devices decide to:

  • Develop for the most common devices.
  • Develop so that it looks “kinda ok” on most devices.
  • Use hacks to get it to work on a couple of other devices.
  • Somehow use the WURFL database.

Several of our solutions revolve around displaying maps. We want the maps to fit to the width of each device. We also like to know what an acceptable base font size is. We want to know as much as we can about every device, so that our solutions work perfectly regardless of device. We run Salamander behind every major (and minor!) solution we develop here at Locatrix Communications to solve this.

Salamander lets developers write layout code for all devices at once. By allowing any service to get any attributes about any device. Mobile applications no longer have to look “kinda ok” on some devices. Applications become tailored to each device. For example:

  • Display size
  • Supported WAP version
  • Supported Java version
  • Official support by an MNO
  • Default font size.

The web-based front end of Salamander also allows us to instantly change and/or rollback changes on any device-specific attributes across all our solutions. Additionally, it automagically pulls community updates from the WURFL database.

To call Salamander, we simply create a new Salamander object and then query the attributes we need.

if (!isset($_SESSION['device'])
{
    require_once('/include/Salamander.class.php');
    $salamander = new Salamander("http://salamander.me");
    $_SESSION['device'] = $salamander->getSalamanderDevice($_SERVER["HTTP_USER_AGENT"]);
}

The Salamander class handles all the communications with the Salamander server. It returns an array of various required attributes for applications to query.

We then query attributes such as:

  • $_SESSION['device']['baseFontSize']
  • $_SESSION['device']['imageType']
  • $_SESSION['device']['imageWidth']
  • $_SESSION['device']['imageHeight']
  • $_SESSION['device']['is3G']

From there we resize images, set font sizes, enable/disable bandwidth intensive features, etc.

Want to try out Salamander with your applications? Want to send feedback? Send me an email!

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • NewsVine
  • Reddit
  • TwitThis
  • LinkedIn
  • Slashdot

Tags: ,

Leave a Reply