3.2Approach 3.2.1Android
One of the first decisions that had to be made was which mobile device operating system (platform) to target the application to run on. The following three common mobile platforms were initially considered: the Android platform from Google [14], Windows Phone from Microsoft [15] and the iOS platform (formally known as iPhone OS before June 2010 [17] ) from Apple [16].
The Android platform was finally chosen for several reasons: this particular platform used a java type language which I already had experience of and so would help to shorten the development time. Additionally, an Android course was being taught in the second semester which would be useful in advancing the project. Although the iOS platform from Apple was a strong contender in the mobile device market [18], it would involve learning the Objective C programming language and it would have required purchasing an Apple Mac for development. The Windows mobile platform was the final platform considered and although it was gaining in popularity and had been receiving positive reviews as an easy platform to write for [21], there were (at the time of writing) currently less devices out there using it than Android or iOS.
The Android operating system was developed by Google and the Open Handset Alliance for smartphones and other mobile devices [12], [18]. An interesting and important aspect of its architecture was its Activity class [23] and its associated lifecycle (as shown in Figure 6.). An activity was typically a window that allowed the user to do something. Typically associated with an Activity was a layout file, used to generate and arrange how “views” appeared on the screen1. An Android “View” was a user interface class that handled screen layout and interactions with the user [22] (for example a “TextView” displayed text and an “ImageView” displayed an image on the screen).
The activity stack was an important aspect of Android and when the user pressed the “Back” key on an Android device it would remove (pop) the current activity and run the previous activity. As detailed in the Android documentation “An application should be able to restart at any time without loss of user data or state in order to handle events … and then returns to your application” [24].
-
Android Lifecycle
Eight Android activities were used in the application, with each class being extended from the base “Activity” class; Figure 7. describes these activities.
BookPickerActivity
|
Set in the Android manifest file to be the first activity called when the application started, this activity acted as the front screen to the application and allowed the user to select different guidebooks and different languages.
|
ChapterListActivity
|
This activity displayed a list of items (or chapters) available to the user when a guidebook was selected. This could include displaying a map or selecting a particular location in the guidebook.
|
PageListActivity
|
This activity was used to display the pages in a chosen chapter. The user could then swipe the screen to move between the pages.
|
MapLocationActivity
|
This activity was used to display the historic and modern maps in the application. It used code from the osmdroid open source project.
|
HGuideEngravingActivity
|
This activity was used to display the engravings (images) in the application. The engravings could be zoomed into, scrolled and rotated.
|
HGuideFlyoverActivity
|
This was used to run the Map flyover feature. This class extended the “MapLocationActivity” class.
|
SubChapterListActivity
|
This activity displayed a sub menu list. There was only one sub menu defined (the “places of interest” list).
|
VideoViewActivity
|
This class/Activity was used to display a video file to the user.
| -
The Android activities used in the application
3.2.2Methodology
A “Software Design Notes” (or “Software Maintenance Handbook”) document was created to store all the notes related to the project. This was created in preference to a paper based workbook as it was previously found to be a better format for searching through and for storing images and web addresses in.
A prototype of the application was created early in the development process to quickly check the technologies being used and to get early feedback from potential users. This was particularly useful for the design of the guidebook pages to check the swiping of pages and how videos could be played. It was hoped that creating a prototype in this way could save time by reducing the number of potential alterations later in the implementation stage.
Since one of the aims of the project was to create a responsive application and to give the user a good experience, a “Now or Nothing” approach was taken: if the user could not access content quickly then the feature was either redesigned or removed from the application. All multimedia data was therefore held locally rather than being streamed from a server.
Another approach taken was not to “re-invent the wheel” when there was already something available either from the Android library or from other developers, then consideration was given to using it. A benefit of this approach was (hopefully) a reduced development time and a more reliable application. An example of this was extending (through inheritance) the existing Android Gallery view to handle left to right swiping gestures and using the open source “WheelView” and “Osmdroid” code.
A spread sheet was created to contain the list of the places that were going to be used in the guidebook application, together with information about them. Images in the "Lost Edinburgh book" were scanned and processed using Photoshop to correct their colour and to lower their resolution. Sections were then added into the guidebook XML file(s).
3.2.3Coding Guidelines
Several coding guidelines were followed during the project: embedding application text in the code was avoided as much as possible with the exception of logging code. This was to ensure the application was multi language. Instead, application text was kept in the Android “strings.XML” file with the content of the guidebook pages being stored either in the guidebook XML file or a Unicode text file.
To make it easier to maintain the code, relevant comments were added in and links made to the software maintenance handbook were added for larger text descriptions. As the coding progressed and features were finalised, code was occasionally refactored to better name methods and variables. The code was compiled with as few warnings as possible and class methods and variables were made private as much as possible to try to keep the implementation details hidden from the other modules of the code. Logging code was added to help in any debugging issues that could have arisen during testing (through the use of the Android logging methods). As much as possible, clear and descriptive names were chosen for the classes and objects in the source code. Backups of the source code were done frequently.
Some consideration was made to make the code as cross platform as possible so if the application needed to be run on a different mobile device (for example, the iOS platform), then it would be easier to port the code (recompile and target it for a different operating system). In practise, this proved quite difficult since the concept of activities in Android is unique. However the parts of the code using technologies such as XML would be more portable.
Since the application was going to be run on a mobile device, some care had to be taken over power usage. It was seen in one study that the majority of power consumption from a smartphone could be attributed to the GSM module and screen display [73]. To help achieve this, an option was added into the settings menu to allow the user to switch off the GPS location feature to conserve battery power. In addition, the application would only attempt to locate the user’s position when the user was viewing the map page.
An option was also added into the settings menu to allow the user to use “High Contrast Text”. If this option was selected, the text in the guidebook pages would be coloured white and placed on top of a black background. This would save battery power (especially when lots of text was being viewed) on mobile devices that used OLED displays since they don’t have a backlight. Instead each pixel is an Organic Light Emitting Diode that makes its own light. Reducing the number of pixels switched on when the device was being used would help to conserve battery power [26].
Other considerations included the small screen size that the application may have to run on: text was sometimes placed on top of other components to save space and so an opacity level was used on the text background (white) so the black text could still be read easily on a dark background. The ability to change font size easily was also important for small screens.
Since mobile devices may not have much RAM, avoiding memory leaks and creating a well behaved application was an important consideration. To avoid memory leaks, the practise of creating Android objects and drawable instances as static class members was avoided [27]. Additionally, the DDMS “LogCat” window was often used to check for memory leaks and other coding issues while the application was being tested.
Share with your friends: |