You are on page 1of 6

Mobile Application Architecture, Implementation

for a Local Gas Prices with Community Participation,


and Gas Station Location

Alex Santos Ramos INTRODUCTION • Create a basic model for a


Master of Engineering This article is part of an initia mobile application infrastructure.
in Computer Engineering five from the engineering services •Be a mobile application that
Advisor Dr. Neffiud Tortes, DBA company Empresas O’Neill, LLC can be used from a cellphone.
Electrical and Computer to enter the mobile development •To obtain near gas stations
Engineering and Computer and application business [1] This with single touch.
Science Department company is currently looking into • Get! Submit gas prices for a
Polytechnic University a local advertisement business gas stations.
of Puerto Rico model using mobile application. • Sorting gas station per criteria.
One of the areas of services been •Use Google Map integration
considerate by the company is the for GPS.
facilitation of local gas prices with • Provide a space for adver
Abstract The objective of this ar
- user participation, and near gas tisement.
ticle is to establish the fundamental station location with minimal list •User identification.
components of a mobile architecture sorting criteria as a value added
model that enables the development for the potential mobile app us Most of the features described
ofa production-graded solutionfor lo ers. As an example, users can de above translate to low-level re
cal (Puerto Rico) gas prices and gas cide to save money on gasoline quirements, but they also allow
station locations. It will establish this by knowing beforehand what are us to start identifying what are
model by ident~[ying each component the price options that they have the mayor needs for the system.
based on the responsibilities ofthe sys dose them. As today (Sept 2018), We can archive this by grouping
tem. Components will be identified by Puerto Rico’s gas prices can vari the above features! capabilities
looking at the basic needs and desired ate from 3 to 8 cents per liter [2]. within mayor components that
features ofthe proposed system,from a More importantly, the article can provide each service. This
high-level point ofview. The approach focuses in encapsulating all the methodology helps in identifying
is to match the system expected be concepts, technology and further components and requirements in
havior with technologies that enable information that enables a mo a general high-level definition for
those fltnctionalities. Once the coin bile application architecture, that the overall system.
ponents are identified, it will describe serve as a building block or/and All the previously describe ca
the interaction between them and starting point to develop more pabilities can be assigned to the
take the basic considerations regard complex mobile solutions into the foliowing components:
ing mobile infrastructure solutions future. •Mobile Application Be a -

like communication technologies and mobile application that can be


security system. It will also provide PROBLEM STATEMENT used from a celiphone, provide a
a prototype mechanism to establish As per every application de space for advertisement, sorting
a custom/proprietary advertisement velopment, this article starts by gas station per criteria, obtain near
system through the mobile applica gathering all the needed capabifi gas stations with single touch.
tion in which advertisement space ties and expected behaviors of the • Web Server Get! Submit gas
-

will be allocated at the mobile graphic mobile application. This is done prices for a gas stations.
interface. Finally, it will consider how by establishing a list of use cases •Third Party Services Use -

the technology developed here can be and desired features. Google Map integration for GPS,
expanded into other areas/solutions. Is expected for that application to: User identification.
B- POLITECHNE
With this exercise, the basic model munication. Nowadays there are phone manufacture of his choice.
of a mobile infrastructure starts to a lots of options as Web Stack, but The manufacture will provide
take shape. for this project a Linux-Apache its Linux Kernel which is from
MySQL-FHP (LAMP) Web Stack where the Android framework
DESIGN wifi be implemented as it covers operates from and the commu
Translating desired/needed fea all the necessities of the mobile ar nication between their hardware
hires to system components cre chitecture in a relative simple way and the Android OS called Hard
ates a starting point for 11w de 8] [9] The AWS EC2 instance ware Abstraction Layer (HAL).
sign. The design is developed by wifi provide the cloud/web com The OS wifi provide a complete
expanding and completing the puter to host a Linux OS. Linux environment from where to run
existing identified components by wifi be hosting the server Apache an Android application [13] This
.

taking into consideration all tech to receive the HTIEP requests to means that the implementation of
nical aspects that are required to the server [10] Other two compo
. the mobile client will only need to
build the mobile architecture. nents that the OS will be hosting focus on the Android mobile ap
There are three more functional are the database system MySQL plication.
ities that from a technical aspect and the scripting language pre Finally, the inter component
are required to complete the mo processor PT-IF MySQL wifi con communication wifi be imple
bile infrastructure, and those are: tain the mechanism to storage mented using a RESTful API.
•htter Component Conunu data in the OS file system and the The RESTful API make use of
nication individual components
- language to request and submit the HTIP technology to establish
needs to have a common way to data on it [11] P1W is a hypertext
. communication between web and
communicate with each other. processor that allows us to define mobile components [14].
•Data Storage —need to store all and handle the server request/re
prices submitted by the users and sponse and the local interactions IMPLEMENTATION-WEB
provide them back to the users. with the database [12] See below . SERVER
• Security the infrastructure
— illustration for an overall setup for The web sewer is divided and
needs to provide the basic prin the web server configuration. implemented into the following
ciple of security: confidentially, in groups:
tegrity and availability (CIA) [3]. • database management
Internet
•security and access
From now on all the components
are identified from the ground up ,j—~-- - - - —.F~ EC2 Linux Wi
•third party services
•suppoi-t
starting from what will host each
component of the mobile infra ~ t e MYSQL The database manage
Apache ~ PF4P
structure, up to which technolo ment control the access to
gies are used to implement them. the database management
To run a web sewer, we need Server!
Inter Component Comm ~ Data Storage system and the stored data
to select an Infrastructure-as-a- for internal (mobile app au
Service (laaS) provider [4] [5] Figure 1: Web Server thentication) and external
The IaaS provides the computing (app data) requests. It is executed
and cloud resources to host the The remainder of the respon by three PHI’ classes which are:
mobile infrastructure server side. sibility for a mobile architecture • db_config.php
This project will be build using fails under the Mobile Client. • db_class.php
the Amazon Web Services (AWS) The Mobile Client will provide • db_manage.php
Free Tier in particular the Ama the users the mobifity meaning
zon Elastic Compute Cloud (EC2) that the service available from The db_config holds the infor
and the Elastic Load Balancer ser anywhere where there is a mo mation needed to connect to the
vices [6] [7] Over this IaaS a Web
. bile carrier data signal. For this database management system.
Stack can be installed to support project it will be used the well- The db_class defines the object
all the Web Sewer functionalities, established Android Operative with which the web server con
Data Storage, Security and part System (OS) en~ironment. The nects to the database system in
of the Inter Component Com user wifi be able to choose a cell order to provide and request
POLITECHNE -7
information to the database in called Places API. To manage the plication to ask the server to re
a generic aspect. These two file Places API endpoints and creden quest all near gas stations from
codes contribute into creating the tials the following code file was the Google services Places API.
technology for the mobile archi created: The set_gas_prices allows the
tecture. Last db_manage is the ap =google_api_config mobile application to ask the web
plication specific implementation server to store gas prices for a gas
for the database which defines the Another third party service station near the user that was pre
queries that wifi be performed by needed for the system is the defi sented as a part of gas station list.
both the web server and the mo nition of valid gas prices. This is To support the ability to provide
bile client application. taken for the local Puerto Rico gas prices by users, the mobile
Creating a service that is acces consumer department DACO application can get a valid range
sible through the internet brings [2] The following code file man
. for gas prices from the web server
the challenge of how access to age to grab the price ranges from by using the endpoint get_price_
that service wifi be managed. The DACO: ranges with which the application
security and access from the web =Get_daco_gas_price_rang can determine if the prices pro
server point of view are related to es.php vided by a user are valid or not.
geffing access to the web server To support the business models of
services, and which http protocols Finally, there is a support func providing ads the REST API have
are used to communicate securely lion to calculate distance between the endpoint get_ads which re
to the server. The following code the coordinates of the user loca turn all the ads entered by the da
ifies manage these aspects: tion and the gas stations near him. tabase administrator in the data
• fliletealo_api_authorizer.php base. This endpoint also provides
•http_post_only.php IMPLEMENTATION RESTAPI- a possible component for future
The REST API is used in other different mobile architecture.
The fuletealo_api_authorizer to enable a standardize way from To complete the RESTAPI all
will ensure that the mobile appli which two different components the http calls were defined within
cation developed for this mobile can communicate with each other. and Android library [16] Within
.

architecture is the only with ac This communication is done with this library various java classes
cess to the web server services. It the use of the http verb POST. The where defined to enable commu
does that be validating a unique two components that wifi make nication through the RESTAPI.
information provided by the mo used of it in the mobile architec The classes can be group under
bile application against what is ture are the Wed Server and the the following categories:
store on the database for the same Mobile Application. The mobile •HflP Connector: REST(Jtil.
mobile application. application will always be the re java
Of all the http methods avail quester and the web server will be •RESTAPI client: Server.java
able the http POST is the only the responder. •Data modeling: UserData.
that don’t expose the user / client At the web server side, the RE java, GasPrices.java
submitted data on the request STAPI make available the follow • Support: AppFingerprint.
url. Therefore, the http_post_only ing endpoints (urls): java, Hash.java
code file will ensure that all re • (domain)! get_gas_stations.
quests made to the web server php The RESTUti1 class provides
are POST methods or they will be • (domain)! set_gas_prices. the bare bone of the htttp protocol
rejected. These two code files wifi php for the mobile application which
also provide towards creating the • (domain) I get_price_ranges. is used by the server class to con
mobile architecture technology. php nect!use the endpoints provided
Between the application spe • (domain)! get_ads.php by the web server. The server
cific functionalities there is the class also make use of the Ap
capabifity gas stations near to the The main two functionalities of pFingerprint and Hash classes to
user. To accomplish this, the sys the mobile application are getting provide the web sewer a unique
tem make use of a third party ser near gas stations and providing irtfomwtion with which the serv
vice from Google that enables this prices for them. The get_gas_sta er can uniquely identify the mo
functionality at a sewer level [15] tions.php allows the mobile ap bile application. Finally, the data
8-POLITECHNE
modeling classes UserData and [17] The data modeling classes
. U
GasPrices are used for easiness to put together all data infomtation
data allocation and transmission. into an object for easiness of use P~mi. Ri~d) P1566)

This Android library represent a and manage. To control the com 1.2km D;(.d6) ‘lies

building block for fixture mobile ponents of the list view fo’r the d loom W(.66)
0:(.ddl P(id6)
Jon
0
architecture as well. gas stations the ListAdapter was
created. The list can sort the gas
e Pin.
32ki11 51.46)
01564) lOSS
P1*44)
0
IMPLEMENTATION MOBILE - station list by using the class My- ‘•
PinS
3.2km
ft (odd)
i:(Sd6)
P1.4*
Joe.
0
APPLICATION Comparator which allows the list
The mobile application can be to be sorted by gas station brand,
P....
130*i
t(d4)
01.dd)
~1s4*
Ills,
0
divided into two major areas: its distance and prices. To obtain the O 3.6km ~. i:(.d6)
5(564) P1Airs

code and the graphical user inter


face (GUI).
user coordinates the application C 37Pin.Ols 0:(.4d)
51*64) P1.64)
Plies
0
uses the class locator which wrap
The application code can be all the steps needed to request co
haven
40km
t(id4)
0:(e4*
P1*6*
bus
0
divided as well into its functional ordinates from the location pro
Peso
40km
ft (odd)
i:(.d4
~ (.46)
SW.
0
blocks as follow: vider Android system class [18].
•View Controllers: Splash- This second part of the mobile
ToW
40km
5(*66)
01.6*
P1s6*
‘Jon 0
~ a’
ld4~ 5(146) P1°d*
Screen, MainActivity~ DetailsPop application implementation is al
Up, SortPopUp. located to illustrate the GUI. The
•Managers: AdsManager, Re application starts with the presen
gion Validator, GoogleSigninMan tation view which shows the ap Figure 3. Main Activity
ager. plication (Fule73alo) and the com
•Data Modeling Miteni, Region. pany names. lected the user is taken to a link
•Support: ListAdapter, MyConi related to what is been advertised
parator, Locator. in the illustration.
•(It also makes use of the An 2. Long Row Click when the
-

droid library mentioned before). user holds a long click in an item


of the list the applica lion popup
The responsibility of the view a window showing more detailed
controllers is to put together the information of that gas station
user GUI and handle all the user’s FuIel3aIo
and further options.
request through the GUI interac 3. GPS Icon when selecting the
-

tions. The AdsManager class is in GPS icon, the application does a


charge of requesting the ads from transition to Google Maps to ifius
the web server and presenting trate the location of the gas station.
them switching from one to an- 4. Drag List Down by drag

other in a timed cycle. This class ging the gas station list down, the
can be used as well as a mobile application request again the list
architecture building block where FMPIII> i~. IP~kIl.l_ 1.11 of gas station neat and them up
and ads system is in place. Since dates the list accordingly.
the mobile application is devel 5. Three Vertical Dots Icon -
Figure 2. Initial Splash View
opec! for a local (Puerto Rico) au when selected it present the user
dience, the class Region Validator an option to logging (identi~’)
evaluates the current user coor After the user passes the loca itseJf into the application. This is
dinates to enable the application, tion validation where his current required to submit gas prices.
if the user is outside an autho location is evaluated against an 6. Sort Icon when selected it

rized region, the class make the authorized region, the user is tak presents a popup window to se
application close right away. The en to the user principal view the led a criterion for sorting the pre
GoogleSigninManager wrap the main activity. sented list.
configuration for using a sign in The main activity offers the fol
system with the Android account lowing GUI interactions: To be able to submit gas prices
used for the Play Store application 1. Ads when this area is se the user needs to login using its
POLITECHNE -9
Google account. Once logged in, it tioned here because of the AWS
can perform a long click over the sign certificate feature. This will
gas station row for which it wants create an https communication
to provide/update gas prices. On protocol which is encrypted be
the text input fields, the DACO’s tween the server and the mobile
defined prices ranges are shown. application [211.
Distance

SISIIOII Name
FUTURE WORK
Gas Prlce/ie~uiar
A very important aspect of a
mobile architecture that use da
Gas Prlce/Pi*rnium
tabases is the maintenance of it
Gas prIce/Diesel
which includes period backups so
Gasolinam a,eo Means”
that the system data source can be
21-23 PueeloRIcoO5l, 71511110 Alto
restore completely if necessary.
Another important aspect is
Urdate Gas PsCfl

cq’ia’1777-81 7) the ability of the system to ex


ProlnIurn (537-917) pand/increase its computing
~7 78’) Figure 5. Sort by View resources. Amazon includes a
system designed for this called
CANESL St*MIF
SerlIce S1SIIOR Tomásd X 4, Elastic Beanstalk which is a tech
JJ~ %., nology that allows the scaling of
~ the infrastructure. Other IaaS of
A / fer similar solution [22].
Figure 4. Station Details and Submit Prices Finally, the Fule73alo applica
P.,rAsss.fla0
Espies.
L.IWIO
tion have a potential to expand its
EL CINCO functionality into a travel or road
Once the list of gas stations assistance including services like
near the user is obtained, the user finding food restaurants, hotels,
can choose to sort the list by cri car rentals and others.
teria as follows: distance, station
name or prices. CONCLUSION
Once a gas station is chosen Puma Service Station From the information gathered
-a
as the place to fill up the user car throughout the design and imple
gas tank, if the user is not famil 0 MOSS LNFO
mentation of the mobile architec
iar with the gas station it can then ture a generic version of a mobile
request for the application to pro Figure 6. Google Map View architecture can be defined. Figure
vide direction in a GPS fashion
step by step. This is enabled by tion data. For this purpose,
the Google Maps Intents which the public-key cryptogra
allows a transition from our ap phy is used in particular
plication to the Google Maps ap the NSA implementation
plication [19] The intent uses the
. [20] AWS services enable
.

coordinates of the gas station se this functionality by us


lected by the user. ing a certificate signed by
them. But this signed certif
SECURITY (CERTIFICATE FOR icate can only be assigned
ENCRYPTION) from the load balancer that
Figure?. Web Sewer Infrastructure
The final consideration will be the free tier services pro
regarding security Since the com vides. The load balancer
munication is performed using has a difference purpose which 7 illustrates this generic version
a RESTAPI services, there is the is outside the scope of this article, named Web Server Infrastructure.
need to encrypt the communica which means that is only men- It presents the web server setup
10- POLIIFCHNE
and all technology aspects of the as a base code, but it wifi surely application specific case, but it can
web server, be a helpful reference for a future be a reference for future mobile ar
The RESTAPI implementation mobile architecture. chitecture. This is a mobile archi
described here is an application tecture knowledge that can be ex
specific development which it This is also the case for the mo- panded by creating new solutions
cannot be used directly as defined bile application which is also an using this article as starting block.

References

[1] Empresas O’Neill. (2018, October 17). Enzpirsas O’Neill, LLC [Online]. Available: https:/ /www.empresasoneiilcom.
[2] Departan-iento deAsuntos del Consumidor (DACO). (2018, October 17). Precios de Gasolina [Online].
Available: http: / I daco.pr.gov/servicios/precios_combusti bles/preciotgasolina IPages/default.aspx.
[3] C. P. Pfleeger & S. L. Pfleeger, Analyzing Computer Security, Prentice Hall, 2012, ch. 1.
[4] ProlitBricks. (2018, October17). What is Infrastructure as a Service (IaaS)? [Online].
Available: https: / Iwww.profit bricks.com/en’us/cloud-lexicon/iaas/.
[5] Stackyfy. (2017, October 7). Top IaaS Providers: 42 Leading IaaS Providers to Streandine Your Operations [Online].
Available: https:I Istackifycoml top-iaas-provi ders?.
[6] AWS. (2018, October 17). AWS Free Tier [Online].
Available: https:/ Iaws.amazon.com/free/?awsf.Free%20 Tier%2OTypes=categories%23l2monthsfree.
[7] AWS. (2018, October17). Amazon EC2 [Online]. Available: https:/ Iaws.amazon.corn/ec2/.
[8] StackShare io. (2018, October17). Tech Stacks [Online]. Available: https:/ /stackshare.io/stacks.
[9] M. Korsak. (2016, May 31). What is a LAMP Stack? [Online].
Available: https: I /medium.comllinode-cubelwhat -is-a-lainp-stack-4c36da4d2aa8.
[10] Mozilla. (2018, October 17). An overview ofI-ITTP [Online].
Available: https: / Idevelopetmozilla.orglen-USI docs/Web/HTFP/ Overview.
[11] MySQL. (2018, October17). What is MySQL? [Online].
Available: https: / Idev.mysqLcom/doc/refman/5.7/en/wl-iat-is-mysql.html.
[12] PHP. (2018, October17). What is PHI’? [Online]. Available: http:/ /php.net/manual/en/intro-whatis.php.
[13] Android, Developers. (2018, October 17). Platform Architecture [Online].
Available: http://php.net/manual/en /intro-whatis.php.
[14] REST API Tutorial. (2018, October 17). Learn REST: A RESTJId Tutorial [Online].
Available: https:/ /www.restapi tutorial.com/.
[15] Coogle. (2018, October17). Places API [Online]. Available: https: / /developers.google.com/places/web-servi ce/intro.
[16] Android. (2018, October17). create an Android libranj [Online].
Available: https: / /developer.android.com/studio/ projec~/android-library.
[17] Android. (2018, October 17). Coogle Sign-In for Android [Online].
Available: htips:/ /developers.google.com/identi ty/sign-in/android/s tart-integrating.
[18] Android. (2018, October 17). Location Strategies [Online].
Available: https: / /developer.android.comlguide/topics/loca don/strategies.
[19] Android. (2018, October 17). Google Maps Intents for Android [Online].
Available: https: / /developers.google. corn/maps/documentation/urIs/android-intents.
[20] w. Stalling, Ct yptography and Network Security, Pearson, 2012, ch. 9.
[21] AWS. (2018, October 17). Elastic Load Balancing SSL/ITS cerflficates for classic Load Balancers [Online].
Available: https: / / docs.aws.amazon.corn/elasticloadbalan dng/latest/classic/ssl-server-cert.hhnl.
[22] AWS. (2018, October 17). AWS Elastic Beanstalk [Online]. Available: https:/ /aws.arnazon.com/elasticbeanstalk/?ncl=h_ls.

POLITECHNE .11

You might also like