Test Case Title |
TC9.6 - IOT Application on Android |
Goal |
Run an IoT Application on a Mobile Phone with Android, and a sort of interactive IOT edge |
Prerequisites |
A mobile phone with Operating System Android. Skill to install app on the mobile phone. Little skill on write command on terminal. The following functionalities are available only for specific Snap4city users with specific privileges. |
Expected successful result |
Using IoT Application. |
Steps |
see Mobile Phone Android as IOT Edge with IOT Applications in Node-RED
Download the mobile application for ANDROID with NODE-RED from
video with a demo of two IOT Applications developed for managing the direction of traffic in a street synchronized each other: https://www.snap4city.org/download/video/direzionatore-demo.mp4
The following pages explain how to from yourself to create a Node-RED based solution on Android. While if you download and install the above applications all the work is done and you can concentrate che activity on IOT Application development. Have a fun!
- The first step to running IoT Application on a smart phone is to install the Termux, Termux:Api, and Termux:Boot applications. The first one allows you to run a shell inside Android and is used to install NodeRed as a package inside the shell, the second one is used to use the hardware made available to the phone (camera, sensors, vibration) and the third one to start the shell when you turn on the phone. Since these applications are OpenSource but the developer pays the last two we have compiled the applications with our key and you can download the APK to install at these addresses:
- Only Termux and Termux:boot appears on the screen that displays the installed applications, but if you go to the settings you can see all three installed.
- Click on the Termux app and you can see the follow screen:
- The following commands must be entered into the terminal. Each command followed by sending and if "Do you want to continue?=" is requested it must be pressed "y".
apt update
apt upgrade
apt install coreutils nano nodejs termux-api
npm i -g --unsafe-perm node-red
- Arrived here we have installed everything you need to run nodered inside the mobile phone and to read the data of the phone
- To launch nodered just write the following command in the terminal and press enter
- The terminal must write these lines
- Press the home button and open a browser. Go to http://localhost:1880
- Now you can develop any flow you want. If the phone screen is too small to see the streams you can see the nodered interface by connecting with a PC browser to the IP address of the mobile followed always by :1880
- In order to use the nodes that read the mobile phone data, you must go to the settings in the "Manage Palette" menu. Then go to the "install" tab and once you've searched for "termux" install the only package that appears.
- If the package is installed correctly you should see a screen of this type
- And in the list of nodes must appear these: