📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

Layar

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Layar

PhoneGap/Cordova plugin for Layar to create Augmented Reality Apps

8.4.5
latest
npm
Version published
Weekly downloads
1
-75%
Maintainers
1
Weekly downloads
 
Created
Source

Phonegap Layar Plugin

This is the official plugin for Layar in Apache Cordova/PhoneGap!

The Layar plugin for Apache Cordova allows you to use the JavaScript code in your Cordova application as you use in your web application to build an augmented reality app.

  • Supported on PhoneGap (Cordova) v3.3.0 and above.
  • This plugin is built with
    • iOS Layar SDK 8_4_4 20160315 b4e8c76
    • Android Layar SDK 8_4_4 20160229 1c600ef

Plugin Requirements and Set-Up

To use this plugin you will need to make sure you've registered with Layar and obtained your Layar Key and Layar Secret.

Limitations

Callbacks are not supported in the plugin. With the plugin you can launch a scan view or open a layar but cannot get javascript callbacks about what is going on. To implement callbacks please use the iOS and Android SDK natively.

Install Guide

This plugin requires Cordova CLI.

To install the plugin in your app, execute the following (replace variables where necessary):

# Create initial Cordova app
$ cordova create myApp
$ cd myApp/

$ cordova platform add ios (For iOS)
$ cordova platform add android (For Android)

# Add the plugin
$ cordova -d plugin add <path-to-phonegap-layar-plugin>

Its that simple!

Example App

We have provided an example app with the plugin. You can just copy the javascript file index.js and the corresponding html file index.htmland use it in your example app. Please dont forget to replace your key and secret in the index.js file.

Optionally you can also automatically generate an example and run it using dart. Just run 'dart test/run-sample.dart <ios/android>' from the command line.

API

Initialize

LayarPlugin.initialize(Layar Key, Layar Secret)

Initializes the layar plugin with a consumer key and secret

parameter (key) The oauth consumer key. Please contact layer support to obtain a license if you dont have one.

parameter (secret) The consumer secret. Please contact layer support to obtain a license if you dont have one.

return {Q.Promise} which you can use to implement success and failure callbacks.

For example:

LayarPlugin.initialize('asdasd;adiaspdiasdpa', 'asdasdasdasdadsasd'). then(Layar.success). fail(Layar.failure). done()

Open Scan View

LayarPlugin.openScanView()

Opens the scan view.

return {Q.Promise} which you can use to implement success and failure callbacks.

For example:

LayarPlugin.openScanView(). then(Layar.success). fail(Layar.failure). done()

Open URL

LayarPlugin.openURL(Layar URL)

Opens a layar view with a layar URL. Especially useful for opening geo layers

parameter (url) The URL to open. Example-> layar://carscen7g?param=value

return {Q.Promise} which you can use to implement success and failure callbacks.

For example:.

LayarPlugin.openURL('layar://carscen7g?param=value'). then(Layar.success). fail(Layar.failure). done()

Open Layar

LayarPlugin.openLayar(Layar Name)

Opens a layar view with a layar name. Especially useful for opening geo layers

parameter (layarname) The name of the layar to open. Example-> carscen7g

return {Q.Promise} which you can use to implement success and failure callbacks.

For example:

LayarPlugin.openLayar('carscen7g'). then(Layar.success). fail(Layar.failure). done()

Keywords

ecosystem:cordova

FAQs

Package last updated on 11 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts