Bachelor’s Thesis (UAS) Degree Program: Information .

1y ago
32 Views
1 Downloads
3.80 MB
46 Pages
Last View : 8d ago
Last Download : 1m ago
Upload by : Macey Ridenour
Transcription

Bachelor’s Thesis (UAS)Degree Program: Information TechnologySpecialization: Android Application development2013Amrit PoudelMOBILE APPLICATIONDEVELOPMENT FOR ANDROIDOPERATING SYSTEM–Case: NepGuide Mobile

BACHELOR’S THESIS ABSTRACTTURKU UNIVERSITY OF APPLIED SCIENCESDegree Programme Information TechnologyJune 2013 45 pagesInstructor: Patric Granholm‘NepGuide Mobile’ is a mobile application developed for NepGuide Pvt. Ltd. NepGuidePvt. Ltd. is a newly established service providing company in Nepal. NepGuide Pvt.Ltd. provides online business and telephone directory of companies in Nepal. Theobjective of this thesis was to develop a mobile application for android mobile devices forNepGuide Pvt. Ltd. This thesis aims to help Android app developer and anyone interested indatabase application to understand the basic fundamentals of mobile application developmentprocess. The created application is capable of fetching arrays of information based on usersqueryfrom the database server and logically display them on the mobile devices in the mostcomprehensible way possible. The thesis describes different aspects of mobile applicationdevelopment for Android devices.‘NepGuide Mobile’application was designed and developed for Android supportive mobiledevices in Eclipse IDE using the Java programming language. As a result of this thesis, anAndroid mobile app was developed and tested successfully. This application offers onlinebusiness directory of companies in Nepal, which is one of the prime online services provided bythe NepGuide Pvt. Ltd. Nevertheless, more services and features can be added to bettercommercialize this application in the future.KEYWORDS:Android, Eclipse and Database

TABLE OF CONTENTS1. INTRODUCTION52. ANDROID OPERATING SYSTEM63. ANDROID APPLICATION63.1 Android stack73.2 Main Building Blocks73.3 Native Libraries113.4 Programming Languages124. ENVIRONMENT SETUP134.1 Eclipse134.2 Android SDK144.3 Android Emulator155. APPLICATION FUNDAMENTALS176. APPLICTION DESIGN186.1 Design Process196.2 Design Method217. APPLICATION DEVELOPMENT137.1 User Interface137.2 Database248. APPLICATION TEST259. CONCLUSIONS29REFERENCES31APPENDIX31

FIGURESFigure 1. Android ub/wiki/IntroductionFigure 2. Activity ife-cycle-of-android.htmlFigure 3. Android n-building-blocks-in-android.htmlFigure 4. Android Broadcast ain-building-blocks-in-android.htmlFigure 5. Android Service main-building-blocks-in-android.htmlFigure 6. Android Content ain-building-blocks-in-android.htmlFigure 11. Android Compilation and Build /index.htmlFigure 7. Eclipse IDEFigure 8. Android SDK ManagerFigure 9. AVD ManagerFigure 10. Android EmulatorFigure 12. NepGuide Mobile UML DiagramFigure 13: Applications icons on Android Device with 'NepGuide Mobile' launcher iconFigure 14. NepGuide Mobile UIFigure 15 Company's DatabaseFigure 16. Search Company by NameFigure 17 Search Companies by CategoryFigure 18. Search Result by NameFigure 19. Search Result by CategoryFigure 20. Company's Full Profile

ACRONYMS AND ABBREVIATIONSOSOperating SystemAppApplicationUIUser InterfaceVMVirtual MachineADTAndroid Development ToolsSDKSoftware Development KitAPIApplication Programming InterfaceIDEIntegrated Development EnvironmentUMLUnified Modeling Language

51. INTRODUCTIONThe mobile phone industry has been developing and growing rapidly during the lastcouple of years. Old mobile devices with limited capabilities are being replaced by newand advanced mobile technology supporting a wide range of mobile services. A mobileapplication (mobile app) is a software application designed to run on smartphones,tablet computers, and mobile devices. “Mobile app” has become a very familiar term inthe world today. The popularity of mobile applications has continued to rise, as theirusage has become increasingly prevalent across mobile phone users. Public demandof mobile apps and the availability of sophisticated developer tools, libraries, andframeworks have made mobile app development easy, fast and productive. Mobileapps can facilitate users with a wide range of services besides normal phonefunctionality such as GPS, mobile games, banking, online ticketing and many more.NepGuide Pvt. Ltd. provides a sophisticated online business and telephone directory inNepal. Businesses in the company’s database are categorized by business type,location and services. It also provides different types of service tools for users tocreate, delete, modify, edit their profile on its website. The information of thecompanies used in this application are either provided by the company itself orregistered on its consent.NepGuide Pvt. Ltd. runs the website nepguide.com and ‘NepGuide Mobile’ is a mobileapplication for this website, which provides all the features and services nepguide.comoffers. The potential of the services this application can offer is immense, however, thisthesis covers one of the very important services provided by NepGuide Pvt. Ltd. Thisapplicationfetches general information(Name, Address, Contacts, Services,Image/Video, map) about businesses from the company’s database and displays themon mobile devices. Businesses in company’s database are categorized by businesstype, location and services.The ‘NepGuide Mobile’ development process can be severed into three sections i.e.,design, development, and implementation. The application design process requiresgood knowledge of Android operating system architecture and general understandingof the application’s intent. The second part of the process, development, is the mostimportant and crucial part in the whole process; it requires knowledge of severalprogramming languages, environment setup, and code debugging. Implementation isTURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

6the final part of the development process which focuses on deploying the applicationon mobile devices after it has successfully been tested on virtual devices.2. ANDROID OPERATING SYSTEMAndroid is a comprehensive open source platform designed for mobile devices. It ischampioned by Google and owned by Open Handset Alliance. The goal of the allianceis to accelerate innovation in mobile computing and offer consumers a richer, lessexpensive, and better mobile experience. Android is the vehicle to do so. Android is aLinux-based operating system mainly used for running mobile devices such as smartphones and tablet computers. Its usability is not limited to mobile devices. Because ofits open and customizable features, it is used in a wide range of electronics devices,like laptops, smart TV, cameras, headphones, wristwatches, game consoles, car CDand DVD players, home automations and many more [Marko Gargenta]. Android OS ishardware independent and runs on devices from different vendors, unlike otherproprietary operating systems such as iOS (Apple Inc. products), Blackberry OS(Blackberry), S40 OS (Nokia), Windows OS (Windows Phone) etc., which are licensedand controlled by certain companies. As of May 2013, Android dominates thesmartphone market accounting 74.4% of worldwide smartphone sales [Gartner].Android is a full-fledged operating system and a complete software stack for mobiledevices. Android APIs are a rich set of system services wrapped in an intuitive classfiles which provides easy access to several features like location, web, telephony, WiFi, media, camera , and so on. All the tools, frameworks and software necessary todevelop a mobile application are available for free .3. ANDROID APPLICATIONAndroid app is a mobile software application developed for use on devices powered byGoogle's Android platform. An Android application can be written in several differentprogramming languages. ‘NepGuide Mobile’ is written in the Java programminglanguage. Although, this application is heavily coded on Java, it profoundly relies on ahuge stack of native libraries written in C . Application developers can easily tap intoTURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

7the huge stack of system services, tools and libraries to use in their application ifrequired.3.1 Android stackAndroid is built on top of Linux. Linux is the base for all the stacks of programs inAndroid. There are so many reasons for choosing Linux as a base of the Android stacksuch as portability, security, networking, great memory and process management, andsupport for shared libraries.Figure 1. Android Stack3.2. Main Building BlocksThe main building blocks are components that a developer uses to build an Androidapplication. These components help break down the work into small conceptual unitsso that the application developer can work on them independently and put themtogether as a complete package.TURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

8There are five application components which are essential to build an Androidapplication. These application components are very important for applicationdevelopers to understand in detail because all the major actions(switching betweenscreens/applications, database manipulation, triggering events, receiving notificationsetc.) performed by an application are handled by them.An Activity is an application component that provides a screen with which users caninteract in order to perform certain tasks, such as dial the phone, take a photo, send anemail, view a map and many more. One application can have several activities that auser flips back and forth on the device[Marko Gargenta]. Launching an Activity is thecrucial part of the Android application development process. The Activity class isprovided by an Android framework, which provides a wide range of facilities likedisplaying user interface, creating a new Linux process, and allocating memory for theUI objects. Typically, an Android application has one main activity which the user seeswhen the application is launched and the user can navigate to other activities asrequired. One activity can start/stop other activities to perform different actions in theapplication. When the user launches a new activity, the previous activity is stopped andthe android system preserves the activity process in the stack. The previous activitycan be resumed anytime by pressing the back button whenever the user is done withthe current activity.Android has a very well-defined activity lifecycle. Android OSmanages activities process by changing its state.Figure 2. Android Activity LifecycleTURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

9Intents represents actions or events that trigger an activity to start, service tostart/stop, or broadcast in an application. Intents are asynchronous messages that aresent among the main building blocks. An activity sends one or several intents toanother application to perform a given task, for example, open a webpage, play amedia file, and so on. Applications capable of performing such tasks could compete tocomplete the task.If there are competing applications, Android asks the user tochoose between applications, and the user can set any application as a default one.Figure 3. Android Intent to navigate from one Activity to anotherA Broadcast Receiver is an intent-based public subscribe mechanism in Android. Thisapplication component allows users to register system events and receive notificationwhen the registered event is triggered such as SMS notification, battery life and so on.The receiver is simply a stack of code in the application that becomes activated when asubscribed events is triggered. The system broadcasts events all the time and thebroadcasted events can trigger any number of receivers. Broadcasts can be sent fromone part of application to another or to a totally different application.BroadcastReceivers themselves do not have graphical representation, nor do they actively run inmemory.TURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

10Figure 4. Android Broadcast ReceiverServices are application components that can perform long-running operations in thebackground. Service components run invisibly, updating the data sources and visibleactivities and triggering notifications. It is an application component that can start aservice and continue to run in the background even when the user is switching throughdifferent mobile applications. Android OS provides and processes predefined systemservices that has to be declared in every Android application[Services].Figure 5. Android Service LifecycleThe Content Provider is an application component that is used to manage and shareapplication databases. Multiple applications can share the same data in so manydifferent ways depending on the type of data. Multiple applications can tap into theTURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

11same data source simultaneously. Content Providers are the preferred way of sharingdata across application boundaries. Android itself includes native content providers thatmanage data such as audio, video, images, and personal contact information.Figure 6. Android Content Provider3.3 Native LibrariesNative libraries are a stack of software codes brought from other open source projects.Native libraries are basically C and C codes required to build an Android stack.There are a several libraries available in the package. Depending on the type ofAndroid device like smartphones, home automation system, car dashboard, nativelibraries can be striped and modified as required. Some of the important native librariesinclude the following:Media codec: Media codec provides different media codecs to supports differentmedia formats.SQLite: SQLite is the database engine, which provides a relational databasemanagement system.WebKit: It is the browser engine for fast HTML rendering.OpenGL: It is an API to render 2D or 3D computer graphics.TURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

123.4 Programming LanguagesA mobile app can be written in several different languages and platforms. However,‘NepGuide Mobile’ was developed using two programming languages and a format tostore and exchange structured data over a network connection known as JSON.Java is general-purpose, structured, generic, class-based computer programminglanguage. Android applications are written in the Java Programming language. AnAndroid application is highly based on Java fundamentals. Java Incorporates withseveral powerful features and libraries of many powerful programming languages likeC, C . The reasons for picking Java as a native programming language for Androidapplication are: It is easy to understand and learn It is platform-independent and secure It is object-oriented Java code is compiled and run by Virtual MachineAll the detailed information and proper documentation on Java can be found erview/index.htmlExtensible Markup Language (XML) is a markup language. It contains some of thevery simple, scalable, and flexible text format that is both human-readable andmachine-readable. It defines the set of rules to encode the document, and usabilityover the Internet. XML is a commonly used data format on the Internet. XML is easy toparse and manipulate programmatically. Android resources preprocess the XML intothe compressed binary format and stores it on the device. Most of the User Interfacelayout, screen elements are declared in XML files. More information on XML can befound on http://www.w3.org/XML/ .JSON (JavaScript Object Notation) is a lightweight text-data interchange format.JSON uses JavaScript syntax for describing data objects, but JSON is still languageand platform independent [JSON Tutorial]. JSON parsers and JSON libraries exist formany different programming languages. It is easy for an application developer to readand write, and for Android devices to parse and generate. JSON is derived from theJavaScript scripting language to represent simple data structure and associative arraysTURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

13which are commonly addressed as JSON objects. More detail information on JSONcan be found on http://www.json.org/ .4. ENVIRONMENT SETUPBuilding an environment to develop a mobile app for Android devices is rather easy. Itonly requires installation of Eclipse, Android SDK and Android emulator to initiate thedevelopment process -although more software and developer tools can be installedlater during the process. Eclipse is considered to be the best Java development toolavailable, the EclipseIDE for java developer provides superior Java editing withvalidation, compilation and cross-referencing. Android SDK is a software developmentkit that enables a developer to create applications for Android platforms. Android SDKincludes application development tools, sample projects with source codes andrequired libraries to built Android application. The Android emulator is a virtual mobiledevice running on the computer. The software emulates an Android device, running theAndroid OS, for debugging applications without needing a variety of devices and OSversions.‘NepGuide mobile’ was developed in a Macintosh system, running Mac OSX Lion asthe operating system. Different versions of software are available for different operatingsystem, depending on the operating system, the right version of the software has to beinstalled. All the required software has versions compatible to Mac OSX Lion. For ml, which includes all the software programsneeded to begin the application development process. If needed, more software anddeveloper tools can be installed later during the process.4.1 Eclipse ADT Plug-inEclipse is an open source collection of programming tools originally created by IBM forJava. Nowadays, most developers in the Java community favor Eclipse as theirIntegrated Development Environment (IDE) of choice. Eclipse lives at http://eclipse.org[Marko Gargenta]. Eclipse is multi-language software development environment, whichhas tools integrated workspaces and extensible plug-in system. The ADT bundle has aversion of the Eclipse IDE with a built-in ADT (Android Developer Tool) to streamlineAndroid app development.TURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

14Figure 7. Eclipse IDE4.2 Android System Development Kit (SDK)The Android SDK provides all the API libraries and developer tools necessary to build,test, and debug apps for Android.[Get the Android SDK]. The ADT bundle has an IDEalready loaded with SDK. By default, only the latest version of Android, API 17, isinstalled and as the development continues, other versions of Android have to beinstalled in order to support a wide range of Android mobile devices. Not all of theAndroid devices use the latest version of Android, so it is important for an appdeveloper to set the API range of an app because some of the class and libraries aredepreciated from a certain API level onward.TURKU UNIVERSITY OF APPLIED SCIENCES, BACHELOR’S THESIS Amrit Poudel

15Figure 8. Android SDK Manager4.3 Android EmulatorAn Android emulator is a virtual Android device running on the computer. The Androidemulator mimics all of the hardware and software features of a typical mobile device,except that it cannot place actual phone calls. The emulator allows an applicationdeveloper to test an Android application on different API levels without using a physicaldevice[Using the emulator]. An Android Virtual Device (AVD) is a device configurationthat is run within the Android emulat

develop a mobile application are available for free . 3. ANDROID APPLICATION Android app is a mobile software application developed for use on devices powered by Google's Android platform. An Android application can be written in several different programming languages. ‘NepGuide Mobile’ is w