A Simple Layer
…and by simple I mean about as simple as it can get:
The Layar mobile app uses the following sequence:
The user chooses which layer they want to use.
The app contacts to Layar, who provide details about the layer (author, description, etc.) and the URL
of your server.
When the layer actually loads, the app sends some parameters to your server (phone's GPS location, radius of their search, etc.).
Your server returns a list of things to be displayed (hotspots), and hopefully confirmation that everything went OK.
The code at the top of the page does that last step; but with an empty list of hotspots (the locations where there'll be some AR).
Creating the Layer
The first thing that you need to do is decide on a unique name for your layer. Once you've got one, you can setup the server side.
Copy and paste the code above into a text editor, change the text: layer-name to the name you've chosen, and save the file with a php extension.
Upload the file to your server.
Check the URL
to your file by visiting it in a web browser. You should only see the text that is inside the single quote marks.
With the file in place, you can now setup the Layar side.
Once you've logged in, click on the My Layers button in the top-right.
Click on the Create a new layer! button.
In the panel that pops-up enter the name that you chose, title, and description. The API
endpoint is the URL
to your file, and you want the 3D and 2D objects in 3D space
option. If the name that you want is already taken, then you'll need to come up with another one. Just remember that the name in the PHP file has to match the one in Layar's listing.
Click the button to Create layer.