CREATE AN AUGMENTED REALITY APP WITH DAPP AND LAYAR PLAYER SDK

Welcome!

This is a two part series on how you can create an Augmented Reality app using just Dapp and Layar.  As part of this series, I have also included the settings for a sample published Layar app for you to try out.

The first required step is that you download the Layar Player SDK – LayarPlayerSDK26May.zip

Alternatively, you can also download the latest Layar Player SDK at http://www.layar.com/tools/player/, just be careful with later versions as instructions might have changed and this tutorial might no longer be 100% correct.

Within the Layar Player SDK is also included the “LayarPlayer SDK 1.1 Documentation.PDF”.  Please open this file when working on the second part of the tutorial as this is the documentation I work from and can assist in getting everything correctly setup.

PART ONE

The first part shows us creating a simple Dapp app that we will export to Xcode.  This will form the basis of our Layar App.

PART TWO

Part two of this video tutorial involves us copying over our exported Dapp code into a new Xcode project.  Feel free to visit Creating an advanced Hello World Xcode 4 iPhone project with Dapp video tutorial for a more detailed rundown of copying over these files to Xcode.

This is my first Audio based Video Tutorial and I feel I might have moved a bit too quickly :P.  All good, just make sure you press the pause button often so you can keep up. Finally, feel free to view the video in full-screen 720p HD mode if you have any trouble seeing any of the code. Everything should then be perfectly clear :).

Amendment: Throughout the video I included Release AND Debug symbols (as well as both the Debug and Release folders). Perfectly fine to use both during development but prior to release, please remove references to Debug symbols and the copied Debug folder from your project as they are no longer required.

The code that we insert during this second tutorial is:

– (void)loadLayarPlayerWithName:(NSString *)layarName key:(NSString *)consumerKey secret:(NSString *)consumerSecret {
NSArray *oauthKeys = [NSArray arrayWithObjects:LPConsumerKeyParameterKey, LPConsumerSecretParameterKey, nil];
NSArray *oauthValues = [NSArray arrayWithObjects:consumerKey, consumerSecret, nil];
NSDictionary *oauthParameters = [NSDictionary dictionaryWithObjects:oauthValues forKeys:oauthKeys];
NSArray *layerKeys = [NSArray arrayWithObject:@”radius”];
NSArray *layerValues = [NSArray arrayWithObject:@”1000″];
NSDictionary *layerFilters = [NSDictionary dictionaryWithObjects:layerValues forKeys:layerKeys];
LPAugmentedRealityViewController *augmentedRealityViewController = [[[ LPAugmentedRealityViewController alloc] init] autorelease];
augmentedRealityViewController.delegate = nil;
[self presentModalViewController:augmentedRealityViewController animated:YES];
[augmentedRealityViewController loadLayerWithName:layarName oauthParameters:oauthParameters layerFilters:layerFilters options:LPMapViewDisabled | LPListViewDisabled];
}

Also, this is the sample Layer Player name, consumer key and secret key to use within the tutorial (if you don’t already have your own).

  • Player Name: nestest
  • Consumer Key: e4c775db9a1d90377764dd8ba06829
  • Secret Key: 3e69effc36

Create an Augmented Reality app with Dapp and Layar Player SDK Dapp Auto-Generated Project Files

As a special treat I’m also attaching my complete Xcode project. Feel free to replace my Dapp generated files with your own, and use it as a starting template for future Layar SDK projects :). The neat thing is that all the frameworks, include files and everything is already setup for you. Please Note: These include/release/debug folders would need to be replaced when using future versions of Layar Player SDK.

Create an Augmented Reality app with Dapp and Layar Player SDK Dapp Complete Project

Comments are encouraged as I’m keen to update this video tutorial wherever might be required. 😀

24 thoughts on “CREATE AN AUGMENTED REALITY APP WITH DAPP AND LAYAR PLAYER SDK”

  • Hi Cliff, this is just amazing stuff!
    BTW I also want to add a feature to this app of adding POI’s to a personal Layar layer by tagging them to the current location of the user/device (I had already made a webapp earlier now I want to make a native app but am very nervous about using xcode for the first time…). I have downloaded a basic sample of displaying the device’s current GPS coordinates, and have got it working. I have also grabbed a simple code for sending these coordinates to the database which Layar relies on to geo-tag specified POI’s. Now I am going to try to assemble all these together, I would greatly appreciate if you can also assist along in this, please? thnx. Mohammad.
    (I can upload my work as folders on googledocs and if you have googlechrome then you can download these folders easily)

    • Sure, I can help out with the Xcode side of things. I like to publicly share any help I provide with other users as well, but get in touch with me directly and I’ll help you out… and post a tutorial afterwards :). You can contact me directly at cliff@kerofrog.com.au.

  • Awesome! that is exactly what I had in mind too…
    and I will be presenting at a conference end of this month in Brisbane on technology usage in public consultation, where i will certainly mention your wonderful tutorials…
    I just finished implementing the above tutorial and it is working beautifully!!
    I will soon send you the links to the rest of the folders…
    take care…

  • Ha Cliff,

    Fantastic tutorial, I hope many people will follow up on it.

    Grtz

    Remco Vroom
    TAB Worldmedia

  • First great tutorial..

    I have having trouble with images not showing and wondering is the complete download packaged with layar 1.1 as I have tried updating to the new verison and the project wacks out.

    The layar support for states that the image issue is fixed with 1.1.

    thanks
    Jacko

    • I’ll be the first to admit that I’m not the authority on Layar. All I can promise is that the attached sample project will work on Layar 1.1, which is the 26th May zip package.

      I’ve had some users update to later versions of Layar and they had to add in some new frameworks to get it working. Best thing to do is read through the latest Layar documentation and include any missing frameworks (or anything else missing).

      I will eventually release a new tutorial to deal with the latest version of Layar.

  • First, great tutorial!!

    However I followed all the steps and I receive a build error
    [BEROR]No architectures to compile for (ARCHS=i386, VALID_ARCHS=armv7).

    I’m running Xcode 4 on OS X Lion: 10.7.1 (11B26, x86_64).

    Any suggestions?

    Thx
    Stefaan

  • Hi,

    I solved the issue by adding i386 to the “Build settings” > “Valid Architectures”

    thx for your time.

    Stefaan

  • Ack. :S… Which versions?

    I might need to update the whole tutorial or just link to later version of Layar SDK.

  • I’m getting the following error on xcode 4.2.1 after installing your complete project –

    ld: warning: ignoring file /DappLayarApp/Debug/liblayarplayer.a, file was built for archive which is not the architecture being linked (i386)
    Undefined symbols for architecture i386:
    “_OBJC_CLASS_$_LPAugmentedRealityViewController”, referenced from:
    objc-class-ref in Game_LayarsViewController.o
    ld: symbol(s) not found for architecture i386
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

    • AAAARGHHH!!! heh… nah, it’s not ThaT bad ;)… But this can sometimes be tricky to solve. A few things…. check that you have all the frameworks added that are needed.

      As the Layar player has been updated since this tutorial, double check you have all the frameworks they need.

      There is also a setting in your build settings called ‘Build Active Architecture Only’ which you can set to no to maybe fix it.

      You can also take out the LibLayarPlayer.a library from your project and put it back in (has worked for me a few times in the past)…

      But yeah, it’s just “one” of those types of issues ;). Best thing by far is to do a google search on the error message you are getting and there are a quite a lot of posts out there going through the different steps you can try.

      Good luck!!!

  • Cliff,

    Also wondering pricing and/or how you bid projects for iPhone/iPad development: i.e. hourly rate or per project scope?

    And to get a feel for your work (code, functionality, and UI) will you please send me a few apps from your portfolio (or examples of projects you’ve done).

    Warm Regards,

    Steve

    • Hey Steve :). I’m currently full time working on project newborn baby daughter! Lots of work!.. and VERY late hours! ;)…. My brain is probably hovering around 53% right now. 🙁

      The workload on the project should hopefully ease up in about 6 months (fingers crossed!!!!!), so get back to me then :D. Thanks!

    • B*tching… I’ll check it out as soon as I can.

      In the meantime, if you do find the solution, forward it on so I can update the code! 🙂

      thx mate.

  • Hey cliff,
    I am a newbie in programming. As part of my curriculum I have to submit a project and I am thinking of developing and navigation application using AR. I am totally new to this stuff.

    Can you help me out with some tutorial like yours to help me build an stand alone navigation app for android or other devices? Documentation or step by step procedures would be really helpful.

    Thanks.

    • Hey bud… **scratch**, not sure I can help here as I have no knowledge of coding for Android and other devices. 🙁 Best bet is to visit the Layar site directly and request or search for tutorials there.

      Good luck! 🙂

  • Hey Cliff,

    Thanks for the indepth tutorial really well done. I was wondering did you make any progress in adding POI’s to Layar? I’m currently starting a project that uses this.

    Cheers,

    Tom

    • Sorry Tom :(.

      POI’s into layar is a little bit outside scope for me right now (can’t commit time to it), and I haven’t looked at layar for quite a while now.

      Perhaps some enterprising soul could find out the answer and forward it on to me so I can share with everyone else :).

Leave a Reply

Your email address will not be published. Required fields are marked *

Enter Captcha * Time limit exceeded. Please complete the captcha once again.