ViewAR-CLI - Command Line Interface

The viewar-cli is a command line tool, which allows you to initialise new boilerplate ViewAR applications based on pure JavaScript or React. Develop and run an app locally or deploy in order to run it on an iOS/Android device or in the browser.

In this section, we show you how to install the viewar-cli, create an app and deploy it.

Installation

Before installing the developer tools, you'll need to make sure that you have two prerequisites installed:

Install node.js from https://nodejs.org/en/download/.

Next, install the viewar-cli globally by entering the following command into your terminal:

npm install -g viewar-cli

(Maybe you need to use sudo npm install -g viewar-cli to have the right permissions.)

You will only need to install this tool once. When out of date, it will alert you and provide update instructions.

Log in with your user

In order to init a project, you need to log in with your account.

viewar-cli login

Initialize an app/template (plain JavaScript / Vanilla)

Initialize a new JavaScript application by opening the terminal in your project directory and entering the following command:

viewar-cli init

If you want to clone and init one of our samples, here is a list of our samples:

Sample/Template Name Description Github URL
base6 Our standard template for furniture and product visualisation. https://github.com/viewar/viewar-template-base6
qr-navigation (COMING SOON) An app for indoor navigation using QR codes. -

Run your app for testing and developing

ViewAR System comes with a local development environment letting you program, debug and test AR applications directly in your browser. Once an app has been created and the dependencies are installed, change the working directory to PROJECT_NAME, and start the development server.

WebGL support

You can start the development server with WebGL support:

npm start

mock mode

You can also run your template in so-called mock mode. It will not load any 3D content but still enable you to simulate all calls, notifications and behaviours directly in your browser.

It comes with 2 buttons in the bottom-right corner, letting you simulate tracking found and tracking lost. Furthermore, it displays thumbnails for scene elements, letting you mimic object selections. This is the fastest way to develop and debug AR applications.

npm run start:mock

Your web browser will open http://localhost:8080/ to access the application.

Start creating your app

To edit the application's code start from src/index.js .

Deploy your app

To deploy the app you first need to create an application at http://developer.viewar.com. In order to activate your template to an app, you need to run:

viewar-cli deploy APP-BUNDLE-IDENTIFIER APP-VERSION

Additional Commands

You can look up all the available commands by simply running viewar-cli without any parameters.