Skip to content

Tap Manager Applications

What is it ?

{{tapviewer.name}} is an application which can view your HTML/Javascript based Web App. It is available on the app stores: - Google Play (https://play.google.com/store/apps/details?id=com.keolabs.keolink.keocom&hl=fr) for Android - Apple Store for iOS

This solution is made for you if:

  • You need a Proof Of Concept for your App.
  • You don't have mobile App coding skills.
  • You don't want to publish an App on the playstore yourself.
  • You want low level communication with the {{tap.name}} to be handled for you.
  • You don't need advanced mobile features such a GPS.

How does it work ?

{{tapviewer.name}} runs your Web App inside a WebView. When you connect to a Tap through the Tap App it will:

  • Read the URL configured on the Tap.
  • Download your Web App from the Cloud (internet connection required).
  • Connect your Tap to your Web App.
  • Run your Web App in the WebView.

Tap Viewer With Custom Web Application{: .center}

Create your app

To create your Web App you have 3 choices:

  1. Use a dynamically created application
  2. Use the App Generator
  3. Create an application from scratch

1. Dynamically created app

See Mobile Development.

2. Using the App Generator

Not documented yet

3. Developing from scratch

To develop from scratch, you need at least 2 libraries:

  • @iotize/device-client.js the core library
  • @iotize/device-com-webview.js for communication between the webview and your application.

Development is similar to developing for the browser except that your app runs inside a webview instead of a navigator.

Minimalist example

Here is a minimalist application that reads the application name configured on the {{tap.name}}.

<html>
<head>
    <!-- ...  -->
    <!-- IoTizeDeviceClient library -->
    <script type="text/javascript"
        src="{{api.javascript.hostedPath}}@iotize/device-client.js@{{api.javascript.version}}/dist/iotize-device-client.min.js">
    </script>
    <!-- IoTizeDeviceComWebview library -->
    <script type="text/javascript" 
        src="{{api.javascript.hostedPath}}@iotize/device-com-webview.js@{{api.javascript.version}}/dist/iotize-device-com-webview.min.js">
    </script>
</head>
<body>
    <script>
    window.onload = function(){
        // We can check first that we are running inside an IoTize webview
        if (!IoTizeDeviceComWebview.isIoTizeWebView()){
            console.error(`Application is not running inside a valid webview.`);
            return;
        }

        // Get device object injected by the WebView
        let tap = IoTizeDeviceComWebview.getInjectedIoTizeDevice();

        // You can now do what you want with the device instance (refer to the Guide...)
        // Connect first
        tap.connect()
            .then(function onConected(){
                // We are now connected!
                // For example we can read the configured application name from the device
                tap.service
                    .device
                    .getAppName()
                    .then(function (response) {
                        let appName = response.body();
                        console.info(`App name is ${appName}`);
                    })
                    .catch(function onError(err){
                        console.error(`Cannot read application name due to error`, err);
                    });
            })
            .catch(function onConnectError(err){
                console.error(`Cannot connect to device due to error`, err);
            });

    }   
    </script>
</body>
</html>

Tips See {{tap.name}} documentation about Sending requests if you don't understand this example.

More advanced web app

You can also develop your web app using your favorite javascript framework such as angular or view.js.

Typescript definition files are provided with the libraries.

See API Guide and Api references.

Publish your app

{{tapviewer.name}} must be able to download your application from the internet, so your app should be hosted on an http server of your choice.

You must also configured your {{tap.name}} to point to the URL of your web app. To do this, use {{iotizestudio.name}} and edit option application path.

By default and for testing purposes, you can use IoTize http server at url http://user.cloud.iotize.com/users/.