Jeremiah Stiable and Doug Rose
Don Lewicki
Capstone / Independent Study
April 12, 2011
Android Application Development
For a final project we, Jeremiah and Doug, selected to make and publish an
Android application. We have both had programming experience and wanted to end our
college career with something to show. With mobile applications exploding in popularity
and both owning Android phones, it only made sense to make an Android application.
Android is a mobile operating system that was first developed by Android Inc.,
which was purchased by Google in 2005. Android is based on a modified version of the
Linux kernel. To release Android to the world, Google and other members of the Open
Handset Alliance collaborated on development. The Open Handset Alliance is a
consortium of 78 hardware, software, and telecom companies devoted to advancing open
standards for mobile devices.
There is a large community of developers writing applications for Android. There
are currently over 100,000 apps available and are wrote in the Java language, controlling
the device via Google-developed Java libraries. The Android operating system consists of
12 million lines of code including 3 million lines of XML, 2.8 million lines of C, 2.1
million lines of Java, and 1.75 million lines of C++.
Android devices are available on all major carriers including but not limited to: T-
Mobile, Sprint, AT&T, and Verizon. Also there are multiple Android devices to better
suit the needs of the masses, where the iPhone only has one current version. This allows
users to pick for example if they want an on-screen keyboard or an actual physical
keyboard.
One of the main reasons Android is leading the market share in mobile devices is
because of the variety of devices they release for each carrier. When Verizon released
the Motorola Droid also known as the A855 or Milestone, it was evident that Android
was going to be a competitor in the market. This device was known to be the first
competitor against Apple’s iPhone. The Motorola Droid was the most popular device in
the Verizon marketplace for a while. This device sports clean lines and a side-sliding
design, which allows for a four-row QWERTY keyboard. It has a large 3.7-inch display
with a 5MP camera, micro-SDHC slot, GPS and Wi-Fi. It came with a 1400mAh battery
that allowed 6.41 hours of talk time and 270 hours of stand-by time. The Droid was
launched with Android 2.1 Éclair and was updated to Android 2.2 Froyo, which holds the
largest distribution of Android operating systems. It had a 600MHz processor with 256
MB RAM and 512 MB ROM. It supported an HTML browser with incredible speed on
802.11b/g/I wireless networks.
Verizon also released their first Android device with a 4.3-inch display, known as
the Droid X. The Droid X is an Android 2.1 powered smartphone with a 1GHz
processor, huge 4.3-inch display with 480x854 pixel resolution, 8-megapixel camera with
720p motion video capture. It contained a 1540 mAh battery that provided users with 8
hours of talk time and 220 hours of stand-by time. It has been updated with various
Android updates from 2.1, 2.2, and 2.3. The Droid X has 512 MB RAM and 6656 MB of
build in memory. It also has HTML web browsing with amazing speeds on 802.11b/g/n
wireless networks. One of the most popular features of this phone is the HDMI output.
This was one of the best Android devices that was released on Verizon’s network until
the HTC ThunderBolt was released back on March 17, 2011.
The HTC ThunderBolt is being advertised as the must-have device with fast
Internet data speeds, a 4.3-inch display, 1 GHz Snapdragon processor, 8MP camera with
dual-LED flash and 720p video recording. This phone is capable of 6.30 hours of talk
time and 330 hours of stand-by time with the 1400mAh battery. The ThunderBolt comes
with Android 2.2 Froyo, 768 MB RAM, and 8192 MB of internal memory. This is the
first 4G Android device released on Verizon’s network.
As owners of both an Android phones and multiple iPhones, we can easily
compare the two. With the iPhone being a closed platform, all apps must personally
approved by Apple. A lot of apps are denied from being in the app store especially if they
modify the iPhone at all such as custom icons or features that are not available on the
iPhone. To install third party apps, it’s required to “jailbreak” your phone, which was
deemed illegal by Apple. The Android marketplace allows almost any app, even ones that
modify the system with a custom user interface. You can also install third party
applications natively. The open source of Android allows for many more useful
applications.
We followed up with research on the popularity of Android devices. An article
posted on March 4th, 2011 states that the latest data from Nielsen shows Android
commanding 29 percent of the market share of smartphone users in the United States.
While one may believe Android is a minority, Android actually topples all of their
competitors. Blackberry has fallen to 27 percent of the market share, which is equal to
Apple’s iOS that has flat lined. Rounding out the market share is Windows 7 phone with
10 percent, Palm OS with four percent and Nokia’s Symbian with 2 percent (Lovecraft).
Once at the top of the market share, Blackberry has been dethroned. With
Blackberry being a popular platform for business devices, companies would buy
Blackberry phones in bulk, between hundred to thousands at once. However, these
enterprise customers have made the switch to Android and iOS devices (Lovecraft). This
also showed us that Android programming could be beneficial even after graduating at a
business level.
One of the downsides to the Android operating system is that it is fragmented.
When Android was first announced it started with Android 1.5 nicknamed cupcake. As
with all Android operating systems, each has it’s own version number, a nickname after a
dessert, and an API level. Each version is improved with Android 2.2 (Froyo) having
major improvements. Android 2.2 also is the most popular with a distribution of 63.9%.
Due to the popularity of this specific version, we decided to use this as our minimum
version. The minimum version would not allow users with Android Versions less than
2.2 to install our application.
The next step was to choose what application we wanted to create. We had an
initial idea to create a “campus application.” We were not sure what specifically we
wanted to create. The plan was to make a functional and useful application that has not
been created yet. The brainstorming stage lasted about a week trying to figure what
direction to take. We decided on a campus map.
For our campus map, we wanted to create an overview of campus with the
campus buildings and dorms marked by pins. We had the option to use a drawing that is
provided by the University or to integrate Google Maps. While the drawing would
provide a centralized view of campus, we believed Google Maps would be more
versatile. Using Google Maps, a user could zoom in and out with great detail or very little
detail. Showing would be a satellite view of campus.
Google App Inventor was recommended as a development tool. We decided to
give this tool a try. It provided a web interface but also used the Android SDK. Setting up
a workspace was very easy using this tool. It provided a WYSIWYG (What You See Is
What You Get) editor to create your GUI (Graphical User Interface).
The WYSIWYG editor allowed you to created the look of your App by simply
dragging, dropping, and rearranging the components provided. These components are
available on multiple palettes and offer a large selection such as: buttons, checkboxes,
labels, list pickers, textboxes, etc.
After creating your GUI, you could “Open the Blocks Editor.” This is a Java
Application that will run without anything else needed. Inside this editor, you are
presented with blocks that resemble puzzle pieces. You drag these puzzle pieces out from
their respected palette and start to build upon each other. Like puzzle pieces, some blocks
with fit together while some don’t. This is a nice feature for beginners so that the blocks
do not get messed up too much. They have blocks for both math and logic functions.
They even have blocks for if and while statements.
After you create your interface and complete the backbones of the application
using the Blocks Editor, you can test the application. You need the Android SDK to be
able to run an Android Emulator. It integrates flawlessly despite the development tool
being on the Internet. It is also said that you can use a developer phone, however, we did
not test this functionality.
When we approached the App Inventor provided by Google, we both took time to
see what the program had to offer. We burned through a few tutorials quickly. It is very
easy to create applications but there are limitations. We continued use of App Inventor to
see if it was possible to create our application with this tool.
Jeremiah went ahead and designed the “Hello World” application, to see how
difficult this Google App Inventor would be. He first designed the application “Hello
World” with ease. Afterwards, he decided to go ahead and implement the text to speech
functionality. With this application he created through the App Inventor, he was able to
create an application that allowed the user to type in a phrase and the application would
then speak (pronounce) what the input was. The output was a typical computer
monotone voice.
Doug found a tutorial that demonstrated how you could use the App Inventor to
make a “Map Tour” application. This tutorial demonstrated how you could choose
certain locations and open Google Maps on the device with pins exaggerating the
location. The tutorial was fairly simple due to the simplicity of the App Inventors color
coordinated puzzle pieces. While experimenting with this program to see how it would
work out for the project we were about to undergo, we decided that the features it offered
were not capstone material.
We quickly became dissatisfied with App Inventor. While App Inventor would be
great for someone with no programming experience, we did not feel that we would be
able to accomplish the goals we set forward. This was due to the restrictions inside of
App Inventor with the biggest restriction only being able to have one screen. Also, due to
have programming experience, the development was overthought on which puzzle pieces
to use. The main problem was “nesting” various functions we would want to use. It
would be easy to program them using code but nesting functions using puzzle pieces was
not an idea we were able to grasp quickly. The final decision was to scratch Google’s
App Inventor and to use Eclipse to create our application.
An Android emulator is provided with the Android SDK (Software Development
Kit). The emulator integrated flawlessly with Eclipse as it did with Google’s App
Inventor. The emulator is a great tool and the less expensive option as compared to a
development phone. We originally started using the emulator to make sure our
application was compiling properly. However, the emulator is slow to load and you did
not get the “feel” for your application. We say you cannot get a feel of your application
because the emulator cannot simulate the touchscreen as a development phone would.
We both have Droid Xs that are available on the Verizon Network. We knew we could
use these to test our application. To use these, we would have to enable debug mode.
This is
accomplished easily
through the settings
menu. Once in
settings, you would
navigate to
Applications. In the
Applications setting,
there is an option for
development. Now once in development, you must check the checkbox titled USB
debugging. This allows your phone to be visible inside of Eclipse.
Despite already owning Android phones, we were provided with an actual
development phone. You are able to purchase these developer phones once you are
signed up as an Android developer. There are only two options for developer phones, the
Android Dev. Phone 2 or the Nexus One. We decided to get the Nexus One due to it
running a new version of the Android OS. The Android Dev. Phone 2 runs Android 1.6,
which is an older version. Currently most Android phones are running at least Android
2.2. The Nexus One ran Android 2.2 out of the box, as did the Droid X. The Nexus is an
unlocked GSM phone so we would not have cellular service due to neither of us having a
SIM card. However, the Nexus One has Wi-Fi, which suited our needs.
We were expecting something different with the development phone. It surely had
to be different than other Android phones since it was a development phone. It wasn’t.
The Nexus One developer phone we received was the same as any other phone except it
was unlocked. Unlocked means that it is not locked down to a specific carrier. This phone
would work with any GSM network by simply inserting a SIM card. The phone was not
rooted. With a rooted phone you have access to everything. While this could be
dangerous, allowing all this power to a normal user, we figured a development phone
would allow us this access. While we didn’t necessarily need this access, it would have
been helpful.
Setting up Eclipse was a little more time consuming than setting up Google’s App
Inventor but it was still an easy process. The first step was to download the Android
SDK, which I had already done for Google’s App Inventor. The SDK is available for
Windows, Mac OS X, and Linux. For our capstone, we would be developing on a
MacBook Air, which is a Mac OS X computer. Using the Android SDK and AVD
Manger, we were able to add and update components in the Android SDK. We then
downloaded and installed the Eclipse IDE. To get the SDK to integrate flawlessly with
Eclipse, we then added the ADT Plugin for Eclipse.
“Android Development Tools (ADT) is a plugin for the Eclipse IDE that is
designed to give you a powerful, integrated environment in which to build
Android applications. ADT extends the capabilities of Eclipse to let you quickly
set up new Android projects, create an application UI, add components based on
the Android Framework API, debug your applications using the Android SDK
tools, and even export signed (or unsigned) .apk files in order to distribute your
application. Developing in Eclipse with ADT is highly recommended and is the
fastest way to get started. With the guided project setup it provides, as well as
tools integration, custom XML editors, and debug output pane, ADT gives you an
incredible boost in developing Android applications (ADT Plugin for Eclipse).”
After the ADT Plugin was installed, we were ready to start programming our Android
application.
Originally planning on co-producing an application with another group, we were
both going to create components and integrate them into one application. However, due
to scheduling conflicts and interfering code we decided to work on our own.
We started by defining the scope of our project. We know we wanted to
incorporate a campus map but we wanted to add more functionality to our application.
The scope changed throughout the build and our ideas changed slightly. This is very
common to any project.
We started by creating a mock design of what we wanted our application to
include. The original design included: Navigate to Campus, Campus Map, Dorms,
Campus Buildings, Gallery, Campus Directory, and Other Information. We created our
mockup using Adobe Photoshop CS5. We decided on using a two-column layout with
large thumbnails for each component. This is a very common layout among many
Android applications with the most popular being Google Places.
The first step in actually creating our Android application was to create a new
android project in Eclipse. This is accomplished by selecting File in the menu bar and
going to New and then Project. If the ADT Plugin for Eclipse was successfully installed,
then there should be a folder labeled “Android” which should contain “Android Project”.
After selecting “Android Project” you click the next button. The next dialog box will ask
to fill in all the project details including: Project Name, Application Name, Package
Name, Create Activity, and Min SDK Version.
“Here is a description of each field: Project Name
This is the Eclipse Project name — the name of the directory that will contain the
project files.
Application Name
This is the human-readable title for your application — the name that will appear
on the Android device.
Package Name
This is the package namespace (following the same rules as for packages in the
Java programming language) that you want all your source code to reside under.
This also sets the package name under which the stub Activity will be generated.
Your package name must be unique across all packages installed on the Android
system; for this reason, it's important to use a standard domain-style package for
your applications. The example above uses the "com.example" namespace, which
is a namespace reserved for example documentation — when you develop your
own applications, you should use a namespace that's appropriate to your
organization or entity.
Create Activity
This is the name for the class stub that will be generated by the plugin. This will
be a subclass of Android's Activity class. An Activity is simply a class that can
run and do work. It can create a UI if it chooses, but it doesn't need to. As the
checkbox suggests, this is optional, but an Activity is almost always used as the
basis for an application.
Min SDK Version
This value specifies the minimum API Level required by your application. For
more information, see Android API Levels (Hello, World).”
As mentioned, we decided to implement an easy to use layout that has been used
throughout many Android applications in the market today. Since this application is
being released on a touch screen device, we wanted to keep the layout simple and easy to
use. The homes screen of the UPB Campus Map application was created using a table
format with two image buttons in each row, two columns, and three rows total.
To create our main layout, you edit the main.xml file. This will be the main user-
interface and the initial layout loaded when the application is selected. Using a table
layout we were able to create our two-column layout.
We set the layout to “fill_parent”, which fills the entire screen giving a clean look.
Using hexadecimal, we were able to set the background color to the Pitt yellow color. We
also centered everything including our labels and our image buttons.
We gave a specific id of the table row for each image button. This allowed us to
specify how many items we wanted in each row. We chose to have two items in each of
our three rows. We used image buttons with custom thumbnails with an appropriate
“layout_height”, which for our example, was 180 pixels.
The first image button called “Navigate to Campus” uses the built in Google
Navigator to navigate to the University of Pittsburgh at Bradford. This button
automatically inputs the address into Google’s Navigator and will allow the user to
navigate to campus from their current location.
To create the backend for the “Navigate to Campus”, we set a button listener to
launch Google Navigation with the GPS coordinates for the entrance of campus at 300
Campus Drive which is the entrance located off of Dorthy Lane.
The second button called “Campus Map” uses Google’s My Map feature. The
Campus Map uses the devices built in Google Maps to open up My Maps which displays
pinpoints at each of the campus buildings, dorms, and other important facilities on
campus. Each of these pinpoints has additional information that also allows you to point
right to that building on the map in an aerial view, navigate to that location, and read the
additional information provided for that location.
For the “Campus Map” feature that we are going to implement in our application,
we decided to use the “My Maps” located within Google Maps. “My Maps” is a great
feature that allows users to create their own maps with pins of exact locations. Along
with pins, you can input information for each location to further address its purpose on
the map. When we located each of the buildings, we color coordinated them all to show
their similarity. The dorms all have a green pin, the campus buildings all have blue pins,
and the main classroom halls have red pins. This really exaggerates the layout of the
Bradford Campus and allows people using this map to figure out which side of campus
the buildings are and their arrangement. While inside this map, when you click on a pin,
it will bring up the name that is corresponds with. Along with the name, it provides the
additional information that we pulled off of the universities website for that building.
Another great feature of “My Maps” is once you select the building that you are
interested in, it will give you the option to navigate to that building with a simple click or
touch, and will take you right to “Google Navigation”, which is built right into the
Android operating system.
While in the planning stage for our application, we knew we would have to input
the GPS coordinates so they would point to the exact location of each building. We
decided to go ahead and use our Android devices to find an application in the market that
would provide the latitude and longitude of our exact location. There were many
applications that you were able to purchase on the market and few that were free. The
two applications that we came across that were of no charge were “GPS Status” and
“GPS Essentials”. The “GPS Essentials” application had a common theme and provided
six features. The first feature was the “Dashboard” where it logged the latitude and
longitude of your location or one you were looking for. The second feature was a
“Compass” that just gave the direction you were facing at that exact time. The third
feature was a “Camera” where it would take a picture of your location using the GPS.
The fourth feature was “Map” and that allowed you to use Google Maps and it gave you
options to find “way points”, different map layers, and your location. The fifth feature
was “Satellite” and it shows you where the satellites are according to a compass. The last
feature of the application is “Way Points” and that allows you to create your own
waypoints in the application. The second application that we tested out was “GPS
Status” featured one screen that shows a compass, pitch and roll, magnetic field, and
acceleration. The two applications that we downloaded both had good intentions but did
not satisfy the needs of our project. After further research, we downloaded Google Earth
to find the GPS coordinates for the buildings that we needed. While gathering some GPS
information, we noticed that a piece of code that implemented this feature for our
application used the coordinates in decimal format.
Google Earth was providing us with the right coordinates but in degrees. We
then started looking for a conversion and came across a website
www.findlatitudeandlongitude.com. This website was the solution to our problems that
we came across for the coordinates. It featured latitude and longitude in degrees and
decimal. By using this website, we were able to place pins at each location that we
wanted to address such as: campus buildings, dorms, and other main attractions at the
University of Pittsburgh at Bradford. We then used a campus map that is provided by
UPB and located each coordinate for all of the buildings on campus that we thought
would be beneficial for any student, employee, or visitor.
The code excerpt below shows that when clicking “Campus Map”, our My Map is
opened in Google Maps. This would allow us to update our My Map online and the Map
inside of our application would also be updated.
The third button in our application is “Dorms” which provides a list of each of
the residential halls on campus. This list enables the user to navigate from their current
location to their selected destination. This button also calls on Google’s built in
Navigator, which gives walking directions to that destination.
The fourth button called “Campus Buildings” also enables the user to navigate
from their current location to their selected destination.
The fifth button called “Gallery” provides various pictures taken on campus.
This gallery has a thumbnail strip at the top of the screen, which can be dragged or
touched to open up the pictures provided. When a thumbnail is selected, a larger picture
displays at the bottom of the screen.
The images are located in an array, which is located in our java class. Using a
gallery slider and gallery view. We were able to showcase various pictures.
The final button called “Other Information” gives additional information for the
Bradford Campus. Information about Dorms, CTM Services, and important websites are
displayed with this button.
When the project is created, the Manifest file, main java class, and the main.xml
are all created. These are the three main files in any android application.
The Manifest file has a few important functions. This is where the application is
named and also gives the current version name of the application. Inside here, you can set
the path to your icon. The icon is what is shown for your application in the app drawer
and also as a shortcut on the home screen.
In the excerpt below, our icon is in the “drawable” folder and named “icon4”. Also
shown is the name of our application that is going to be shown to the users.
For our application we also wanted to lock the orientation. Almost all Android
devices have a gyroscope or a six-axis accelerometer. This allows applications to switch
orientation when the device is tilted from portrait to landscape. With our layout, we
wanted to ensure that the orientation was always in portrait view.
Another key function is to set the intent of the application. By default the intent is
set to “android.intent.category.LAUNCHER”. This allows the application to launch when
the icon is selected. You also have to add permissions for what information needs to be
accessed by your application. For our application, we only needed to add the permission
to access the Internet. We did this by adding the permission
“android.permission.INTERNET”. This would allow the links inside the “Other
Information” page to open in the provided Internet browser. Lastly, this manifest file sets
the minimum SDK version allowed. This SDK Version number is directly related to the
Android OS Version. We used the minSDKVerison of 8, which is linked to Android 2.2.
We previously touched on various excerpts of our java class. Our total java class
exceeded 650 lines of code. A major portion of this code was button listeners. For
anything that was “touchable”, we needed a button listener to wait and see what was
being touched. While it was very redundant and similar code, it was completely
necessary we had all of these.
Because we were using multiple screens or user-interfaces, we had to set up a
synchronized state so the application would not lose focus when switching between these
views. This synchronized state also helped us program the hardware back button that is
on every Android phone.
When the application starts, the state is set to “MainUI” when the activity is first created.
Anytime the user interface is switched, the state is changed accordingly. For example,
when the Gallery button is clicked, the state is changed to “GalleryUI”.
The function of the back button is dependent on what the current state is. When
the current state is not set to “MainUI”, the back button takes the user back to the main
user interface. If they are already at the main screen, the back button will close the
application. This is a standard for all Android applications.
By creating different methods, we were able to use one java class. However, for
each layout, we needed a separate XML file. The XML file created the Graphical User
Interface (GUI) for each separate page. In total we had five XML files including the main
XML file.
After our application was finished, we decided to publish our application to the
Android Marketplace. The process to publish our application was simple. In Eclipse, you
are given the option to export your application. During this process, the application is
signed automatically for devices. To publish to the Marketplace, we had to upload our
UPBMap.apk file with a description, three screenshots, and a high-resolution icon. After
a brief 15 to 20 minutes, our application was approved and available on the Market.
Over the past fifteen weeks, we have designed, created, and published our
Android Application. During this time, we learned a lot about the design and
programming of mobile applications. We cannot say this was an easy experience but it
was a great experience. Both of us have strengthened our java programming and also
learned more about XML. With this knowledge, we can now create other Android
applications with more ease. While comparing our original mock-up and our final
product, we can see how much we have improved the functionality and also the design of
our application.
Works Cited
"ADT Plugin for Eclipse." Android Developers. Web. 01 May 2011.
<http://developer.android.com/sdk/eclipse-adt.html>.
"Hello, World." Android Developers. Web. 01 May 2011.
<http://developer.android.com/resources/tutorials/hello-world.html>.
Lovecraft, Raven. "Android Market Share Topples Blackberry | TG Daily." TG Daily |
Technology, Science, Entertainment, and Business News. 4 Mar. 2011. Web. 29
Apr. 2011. <http://www.tgdaily.com/mobility-brief/54462-android-market-share-
topples-blackberry>.