Chapter 7

Building Layar Layers


  • How to create a layer
  • How to set up the Layar database
  • How to create a web service
  • How to access the layer
  • How to customize the layer
  • How to add actions
  • How to create triggers

In Chapter 1, you learned that Layar is slightly more complicated to develop for than Wikitude. Developers always ask me why I think Layar is complicated; truth is, it’s not. But as you just learned in the previous chapter, Wikitude is incredibly simple to use to build content. Layar requires a little more preparation.

Before you can begin working with Layar in this chapter, you’ll need the following:

  • A publicly visible web server with PHP 5.2 or newer, including JSON support.
  • An FTP application to upload files to your server.
  • A MySQL database (phpMyAdmin is preferred).
  • A PHP editor (such as PSPad) to edit PHP files. See
  • Nearby latitude/longitude coordinates.
  • The Layar mobile application installed to your device.

Please note that your publicly visible web server needs to be a hosted account. You will not be able to configure your home desktop PC as a web server because the Layar client must access the PC and retrieve data from a MySQL database and access the PHP resources.

You can, of course, develop for Layar in other programing languages (such as C#, Java, and so on). You can also use other database products, such as Microsoft SQL Server. However, for the purposes of this book, I will provide examples only in PHP.


Get Professional Augmented Reality Browsers for Smartphones: Programming for junaio, Layar, and Wikitude now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.