The document describes an Android application developed for the Remote Triggered Laboratory project. It provides a brief overview of the app's objectives, development tools used, and design structure. The app was created to act as an interface between users and experiments on mobile devices. It communicates with a LabVIEW server application through the SCCT library. The app's code is organized modularly into packages for each experiment. Future improvements could include adding a login system and developing a hybrid version using PhoneGap and HTML5 for increased flexibility.
1. RT LAB ANDROID APP
Native Android App Development
Praahas Amin
praahas1234@gmail.com
9742508710
Abstract
A brief description of the native android app developed for the Remote Triggered Laboratory
Project. This document explains the functioning of the app, the organization of the files and further
improvements that can be implemented in this project
2. 1 | RT Lab Android App – Native Android App Development
CONTENTS
1 Introduction To RT Lab..........................................................................................................................2
1.1 The Vision......................................................................................................................................2
1.2 Objectives......................................................................................................................................2
2 Center For System Design.....................................................................................................................2
3 RT Lab Android Application...................................................................................................................2
3.1 Objectives......................................................................................................................................2
4 Development Environment & Development Tools Used......................................................................3
5 The Working..........................................................................................................................................5
6 Design of the Android Application........................................................................................................5
6.1 The src folder ................................................................................................................................6
6.1.1 com.android.rtlabs................................................................................................................6
6.1.2 rtlab.experimentname.adapter.pack....................................................................................7
6.2 The res folder................................................................................................................................8
6.2.1 Drawable...............................................................................................................................8
6.2.2 Layout....................................................................................................................................9
6.2.3 Values....................................................................................................................................9
6.2.4 Xml ........................................................................................................................................9
6.3 AndroidManifest.xml ....................................................................................................................9
7 Scope of Improvement..........................................................................................................................9
7.1 Improvements on Native Android App.........................................................................................9
7.2 Hybrid Development using Phonegap and HTML.......................................................................10
3. 2 | RT Lab Android App – Native Android App Development
1 INTRODUCTION TO RT LAB
1.1 THE VISION
To enrich the learning experience through experiential learning of science, engineering and technology in
a virtual learning environment at preferred location, time and pace.
1.2 OBJECTIVES
Set up state of the art virtual experimentation facilities (simulation) in selected areas of
engineering & science.
Setup state of the art experimentation facility in selected areas of Engineering and Science
education which can be used both through remote access and on site experimental work.
Make these facilities available to all the educational institutions and students 24 X 7.
2 CENTER FOR SYSTEM DESIGN
Center for System Design envisages an interdisciplinary approach and means for realization of successful
engineering systems. Key components for this are system modeling & simulation, understanding system
dynamics, system optimization, virtual and physical experimentation. The Centre aims at facilitating and
providing required environment for all the key components of system design. The Centre focuses on how
to address and solve problems that transcend traditional boundaries. Modern engineering problems are
comprised of elements from all the traditional disciplines and these elements must be integrated to meet
the overall design objectives.
SOLVE is the first large scale interdisciplinary project taken up by the center with MHRD funding.
NITK Surathkal has signed an MOU with M/s. National Instruments, Bangalore (NI) in the area of Centre
for Graphical System Design. Centre is also pursuing with many industries and R&D labs to have active
collaborations and MOUs.
3 RT LAB ANDROID APPLICATION
3.1 OBJECTIVES
Design & Development of an Android Application that will act as an interface between the users
and the experiments on Handheld Devices.
Design of an app that is easy to upgrade and manage.
App should provide the features available on the PC based application of RT Lab.
Provide Theory, Procedure, Experiment Interface, Calculation Interface and Results.
4. 3 | RT Lab Android App – Native Android App Development
4 DEVELOPMENT ENVIRONMENT & DEVELOPMENT TOOLS USED
The RT Lab Android Application was developed on a system running Windows. The language used for
development of the app is Java. The IDE used for development for the app is Eclipse along with the
required libraries. Eclipse contains a base workspace and an extensible plug-in system for customizing the
environment. Written mostly in Java, Eclipse can be used to develop applications. By means of various
plug-ins, Eclipse may also be used to develop applications in other programming languages.
Android Development Tools (ADT) is a Google-provided plugin for the Eclipse IDE that is designed to
provide an integrated environment in which to build Android applications. ADT extends the capabilities of
Eclipse to let developers set up new Android projects, create an application UI, add packages based on
the Android Framework API, debug their applications using the Android SDK tools, and export signed (or
unsigned) .apk files in order to distribute their applications. It is free download.
Eclipse was the official IDE for Android but was replaced by Android Studio. The development has also
been tried successfully on the more recently released Android Studio.
The Server side software has been developed on Lab View. The RT Lab Android App communicates with
the server program via a communication library called SCCT (Smartphone & Cross-platform
Communication Toolkit) .SCCT empowers you to reach the end users on any device. SCCT has been created
for developers who want performance, reliability, and simplicity. SCCT takes care of all communication
details so you don't have to. SCCT automatically converts your data streams into a platform independent
format and optimizes package transmission to get best performance. Use SCCT to gather data from your
mobile devices, process data where you want and visualize results on the web. SCCT is easily integrable in
any work system, because it doesn’t need particular hardware and requires only a computer. The great
versatility of LabVIEW, in which SCCT is developed, allows you to connect all those devices that haven’t a
net interface but use, instead, serial ports or custom boards. SCCT offers the same interface for every
platform you need. SCCT is available for LabVIEW, HTML5, Android, Java, iPhone, ANSI C for Linux
You can find and download SCCT libraries by clicking here.
Features of SCCT
- Fully bidirectional communication with mobile applications.
- No web server is required.
- Best choice to create distribute computing solutions.
- High performance data communication on every supported platform.
- Bidirectional transmission of 2D arrays.
- Filtering at server side of analog data and 2D arrays.
- Multilanguage support.
5. 4 | RT Lab Android App – Native Android App Development
Benefits
- High scalability.
- Unified data format among all platforms.
- Create amazing interface with your favorite programming language.
- Control data acquisition and computation from any device.
- Support for HMTL5, Java, Javascript, LabVIEW, ANSI-C, Android, X-Code.
SCCT for Android, Java and ANSI C libraries are available in two different editions:
• Lite Edition, which includes most common functionalities.
• PRO Edition which provides highest performance and advanced features.
*In this project Lite edition has been used.
For More information on SCCT Click Here.
For User Manual on SCCT For Android Click Here.
For information on Getting started with SCCT Click Here.
For User Manual on SCCT for HTML5 Click Here.
The downloaded SCCT library must be referenced in the App initially when creating the project.
Eclipse->Right Click Project Folder->Build Path->Configure Build Path->Add External Jar
(select downloaded SCCT Library file)
Devices used for testing involved various Handheld Devices such as Samsung Galaxy S2, Samsung Galaxy
Note 10.1, Samsung Galaxy Tab, Samsung Galaxy Note 4, Samsung Galaxy Ace , Samsung Galaxy S4,
Samsung Galaxy S5, Google Nexus 5, Nexus 6, Moto G (1st
& 2nd
gen) and Moto E.
The App was tested on Devices running Android Ice Cream Sandwich, Kit Kat and Lollipop.
6. 5 | RT Lab Android App – Native Android App Development
5 THE WORKING
RT Lab Android App communicates with the RTLAB LabVIEW Server Application through SCCT. Data or
control signal is sent from the Client to the server in the form of arrays. The Server can send Data or
Control signal back to the Mobile device in the form of arrays. Data can be in the form of Digital data,
Analog data, Error Data or Configuration Change Data. Corresponding Listeners listen for the appropriate
data type in the Mobile device. Once a user triggers any process through the mobile device, the action
takes place in the server program. An experiment is triggered and Data is acquired using a DAQ and then
the data is collected in the server program and sent to the Client app in the form of array. The listeners in
the app pick up their appropriate type of data and then it is processed. The collected data may be used to
plot charts or graphs for analysis. Any error or change in configuration can also be picked up by
appropriate listeners and may be processed to notify the user.
6 DESIGN OF THE ANDROID APPLICATION
The application will include different experiments. New experiments will get added over time. In order to
make the upgrades easily, the app has been designed in a modular way as shown below. The java classes
of each experiment of the app are organized under different folder, making upgrades, modification and
debugging an easier task.
7. 6 | RT Lab Android App – Native Android App Development
The organization of the programs of the different components of the app is shown below.
6.1 THE SRC FOLDER
The src folder contains all the java programs for the different ACTIVITIES of the application the package.
6.1.1 com.android.rtlabs
The App will contain many different experiments. Each Experiment will be programmed as an activity
having a Main Activity. Each part of an experiment will be programmed as Fragments of the main activity.
8. 7 | RT Lab Android App – Native Android App Development
com.android.rtlabs will contain the MainActivities for all experiments, Login, The Class for Communication
using SCCT, Splash Screen etc. It is as shown below.
6.1.2 rtlab.experimentname.adapter.pack
Each experiment will have Theory, Procedure, Experiment, Calculations and Results Sections.
Correspondingly each section is programmed as a different Fragments of the Activity.
rtlab.experimentname.adapter.pack package will contain the program for each fragment of an activity
and the adapter for the Tab design.
9. 8 | RT Lab Android App – Native Android App Development
6.2 THE RES FOLDER
The res folder contains all the resources required for the app such as images, audio files, configuration
files(in the form of xml) layouts etc.
6.2.1 Drawable
The drawable folders contain images to be used in the app. hdpi, ldpi, mdpi, xhdpi,xxhdpi are folders to
contain the images for different screen resolutions. This helps to deal with fragmentation (lot of different
Android to devices to deal with i.e different brands, screen sizes, screen resolutions etc., unlike Apple
devices which have a fixed type of devices.)
The contents of drawable folder of this app is shown below
*note: Some of these images may be unused.
10. 9 | RT Lab Android App – Native Android App Development
6.2.2 Layout
The layout folder contains the xml code that defines the layout of the Activity of the app. The layouts
maybe defined for different screen orientations such as Portrait mode, large screens of Tablets and
landscape mode. This is achieved by defining the layouts in portraits named layout-port, layout-land and
layout-large. The screen layouts for the different activities & fragments of the RT Lab app is defined in the
folder layout. The organization of the folder is as shown below.
6.2.3 Values
Constant values such as defining the Hex Color values by name, defining strings, styles etc. can be done in
the form of xml codes and stored in values folder.
6.2.4 Xml
Values such as configuration preferences can be saved in the form of xml code and stored in the xml folder.
In this program, an attempt was made to give the user privilege to enter IP address and API Key for each
experiment and then save it. The default values were saved at the time of development. However to avoid
security issues, this feature was discontinued and the IP address and API Key was hard coded. The code is
however available in the development package.
6.3 ANDROIDMANIFEST.XML
The different activities that are used in the program, the different permissions needed such as Internet
connectivity, screen orientation etc. can be defined in the AndroidManifest.xml file.
//The program has been commented inline for the reference of the developer which should help in
understanding the code.
7 SCOPE OF IMPROVEMENT
7.1 IMPROVEMENTS ON NATIVE ANDROID APP
The app does not have a login system yet. Once the login system is ready, the app can be made to work
as explained below:
1. User enters credentials and logs in.
2. The login is checked for validity.
3. If the login is valid, then check if the user has a time slot for an experiment at the time of login.
If the user has a time slot for an experiment, then automatically open that particular experiment.
11. 10 | RT Lab Android App – Native Android App Development
7.2 HYBRID DEVELOPMENT USING PHONEGAP AND HTML
SCCT is available for HTML5. Therefore the app can also be developed on HTML5. This will make
developing and upgrading the app very flexible.
1. The Developer has to develop the app only in HTML which is the same application that will be
developed by the web developer for use over the web.
2. The webpage has to be made using responsive design so that the page will adjust to different
screen sizes. This will ensure the app works on different screen sizes.
3. Phonegap can be used to develop the HTML page into an app.
4. The opening page will be running in the app. The Web page for logging in and performing the
experiments developed by the web developers will be running on the server. The opening page
will check for internet connectivity and then load rest of the pages from the server.
5. Phonegap can convert the HTML page into any platform(such as Android/Windows Mobile/Apple
iOS/ Blackberry)
6. This will make development and upgrading very flexible as the developer has only got to develop
or make changes once in the HTML web page in the server and this will be reflected in all the
platforms. This will reduce development time and also development inconsistencies. Further this
will reduce the size of the application.
7. Phonegap allows to develop the html pages into apps in multiple platforms such as Android, Apple
iOS, Windows Phone, Bada and Blackberry.