Here we have collected everything you need to get started with creating mobile apps for the Internet of Things in JavaScript/HTML using Evothings Studio 2.0.
Evothings Studio is a development tool for creating mobile applications for the Internet of Things (IoT). Evothings Studio is based on web technologies and open-source software components.
Please note that this guide applies to Evothings Studio 2.0 Beta. Version 2.0 is an improvement over version 1.2 in many ways, most notably the connection between Evothings Workbench and Evothings Viewer is more reliable and flexible. (Evothings Viewer replaces the Evothings Client app used with Evothings Studio 1.2.)
Here are the tools you use to develop apps with Evothings Studio:
With Evothings Studio you have the freedom to use any code editor you like. As soon as you save a file, changes will be picked up by Evothings Workbench and connected mobile devices will be notified to update the running app. The live reload mechanism works with all files and formats. For example, if you save a bitmap image in Photoshop, the app will update itself and display the new image.
To make it easy to get started, Evothings Workbench comes with a collection of ready-to-use example apps for various IoT devices, for example Eddystone and iBeacon beacons, Arduino, TI SensorTag, and many more.
Here is a list of what you need to get going:
Here is a step-by-step guide to get you going, right from scratch:
Next step is to modify the example code:
To create your own mobile application project, you have three options:
All of the above methods will create an entry under the tab "My Apps". You can rearrange app entries using drag and drop. Close them using the close icon (x). This will not remove the files on disk.
When you create an app using NEW or COPY, the app files will be saved in a folder on disk. You can specify the folder in a dialog box. If you wish to move the app to another folder, delete the app item under "My Apps" (will not delete the app folder). Move the app folder to the new location. Drag index.html from the system file browser into "My Apps".
To create an app from scratch (or add an existing app you have) follow these steps:
An Evothings app project is just a folder with your HTML and JavaScript files. Just like any web site. And as soon as anything is changed, the Workbench pushes it to all connected viewers, just like that!
In the "More" menu you will find the "Settings" menu option. This open a dialog where you can change the font size used in the Tools window, and the number of directory levels traversed by the reload file watcher. You can also change the default path to the folder used by the NEW and COPY buttons.
The setting for the reload server address is intended for developers of Evothings Studio. In most cases you should not change this value. Default value is "https://deploy.evothings.com". The reload server handles the communication between Evothings Workbench and connected phones and tablets.
The documentation pages contains information about the tools available in Evothings Studio.
Apache Cordova is a build system for creating native apps developed in HTML/JavaScript. You can use Evothings Studio without Cordova, but if you want to create native apps it is needed.
It is useful to know that Evothings Viewer itself is a Cordova app, developed using Evothings Studio.
Cordova plugins are code modules that provides native device functionality, such as Bluetooth Low Energy and iBeacon ranging. Evothings Viewer comes with a number of plugins preinstalled.
Included with the Evothings Studio download:
Note that Evothings Viewer is installed from the app stores, and is not included with the download.
Evothings Workbench runs on top of the nw.js engine (which includes WebKit and node.js). The nw.js binary is included with the download (named "EvothingsWorkbench"). All download packages (Windows/OS X/Linux) are basically identical except for the node-webkit binary.
Here is an overview of some of the files and folders in the unzipped download package:
examples - example apps hyper - JavaScript code for the Workbench server - code that communicates with the proxy server that routes reloads to the Viewer settings settings.js - settings you can modify ui - user interface code node_modules - modules used by node-webkit package.json - Workbench application settings
Evothings Studio gives you several useful tools and goodies:
To learn more about how reload-on-save works, read the article Hybrid app development made fast (kindly note that this article is not updated for Evothings Studio 2.0, but basic principles still apply).
To let others test your app, you have the following alternatives available:
The Cordova IoT Starter Guide contains information about how to get going with building native apps using Cordova.
Also check out the Build overview and the Cordova Guide in the Evothings documentation.
Here’s how to build apps using Adobe’s build service for hybrid apps called Phonegap Build, just follow the instructions in this technical tutorial on preparing and uploading files.
Use the Tools window in Evothings Workbench to write log messages using the hyper.log() function.
Click the "Tools" button in the Workbench menu bar to open this window. Log messages are displayed in the bottom pane.
This will log the current window width for all connected viewers:
hyper.log('window width: ' + window.innerWidth)
And this will log the device name and platform (note that the app must include cordova.js for the device object to be available):
hyper.log('device model: ' + device.model + ' platform: ' + device.platform)
In the top pane of the Tools window you can interactively evaluate JavaScript code on connected devices. This is useful both when developing and debugging an app.
Initially, the top pane contains some code examples you can try out. In case you have erased the initial contents, click the "Restore" button to get it back.
When you quit Evothings Workbench the contents of the top pane of the Tools window is saved automatically.
One good thing to know is how JavaScript libraries are used. JavaScript library files are included in an app using HTML script tags (typically this is done in index.html).
There are two kinds of JavaScript libraries used in a Cordova-based mobile app (such as Evothings Viewer):
Knowing the differences between these are helpful.
Cordova libraries are bundled with the app. You never see the JavaScript plugin files in your own application code. If you wish to browse the source code for a plugin, you have to look in the plugin code, which is available in the plugin code repository (usually on GitHub), and in the native project build with Cordova.
Cordova libraries are included with one single script tag including cordova.js:
<script src="cordova.js"></script>
This will in turn include the JavaScript code for all plugins installed in the app.
These are libraries used by the application. The JavaScript code for other libraries must either be included with the app and loaded via script tags, or loaded from the network using script tags. However, when loading scripts over the network, the mobile device must be online to work, which may not always be the case. It is recommended that all scripts used are included with the app.
Evothings example applications use several JavaScript libraries related to IoT. These are included in the folder "libs/evothings" with subdirectories.
The file "libs/evothings/evothings.js" contains functions for loading scripts asynchronously, which can be useful in some circumstances.
Note that not all example apps have all libraries included, only the libraries actually used are included with each app. All Evothings libraries available can be found on GitHub.
Download Evothings Studio and experience the joy of developing mobile apps for IoT using friendly tools and a fast workflow.
It is fun and easy to get up and running!