Disertatie Stoica Ionut – Tudorel [305524]
[anonimizat] a [anonimizat], [anonimizat]'s idea of "internet of things" to life. Being now a [anonimizat] a 75.66% [anonimizat]'s iOS, which holds 19.23% and other companies such as Blackberry at 4% approximately.
The thesis "Android messaging application based on location services" will follow the development of "Neighbourhood", an Android application which allows users to communicate with other users that are in a given radius of up to 150 km. [anonimizat] a [anonimizat], public places and every other place where the user's proximity to other people would be an advantage.
Nonetheless, [anonimizat]/[anonimizat], [anonimizat] (for refreshing and displaying a message's timestamp) and profile configuring. To represent the application, a logo will be created and a presentation web page as well.
The paper will be structured into three chapters. [anonimizat]. [anonimizat].
Chapter 1. Fundamentals of Android
History
Danger Hiptop/T-Mobile Sidekick
In the early 2000s, [anonimizat]. However, [anonimizat], compared to today's phones. Although the idea of a device that was "more than a phone" [anonimizat] a smartphone that was accessible to everybody was still implausible.
Important steps in this direction this were made in 2002. Then, a [anonimizat], [anonimizat]. [anonimizat] a lanscape oriented keyboard and a [anonimizat]. Likewise, [anonimizat]. Through a partnership with telecommunication giant, T-Mobile, [anonimizat] a [anonimizat].
Fig. 1.1 – T-Mobile Sidekick
First Android phone
Shortly after the success of T-[anonimizat]., a stand-alone company backed financially almost a hundred per cent by Rubin. With a [anonimizat] a [anonimizat]-[anonimizat]. In July of 2005, Android Inc. was acquired by Google for a sum of approximately 50.000.000 [anonimizat] a [anonimizat].
Fig. 1.2 – T-Mobile G1
T-Mobile G1 was the first phone operating on Android OS available for consumers, starting from October 22nd 2008. Although it did not have specifications that were out of the ordinary (it ran on Android 1.0, had a single-core 548 MHz CPU and 192 MB of RAM), it had a QWERTY, landscape oriented keyboard, much like the Sidekick, and an oversized touchscreen for that time, that made it stand out from other phones available on the market. Granted companies like LG and Apple were already making great strides in developing an operating system based solely on touchscreen, the designers considered a physical keyboard to be a more fitting solution to begin with.
Versions
Android 1.5 Cupcake and Android 1.6 Donut
Although Android 1.0 was updated to Android 1.1 in February of 2009, the first real changes came with versions 1.5 Cupcake and 1.6 Donut, launched in April of 2009 and September of 2009, respectively.
Android Cupcake paved the way for touchscreen-only smartphones, having a built-in on-screen keyboard and support for other third-party keyboard applications. Additionally, this was the first version to feature home screen widgets, for example, the analog clock, calendar, music player, and search bar, while basic video recording capabilities were added to the Camera application.
Android Donut brought support for different resolution screens and CDMA networks. Moreover, the Google Search widget was updated to search not only the web, but through contacts, music files, other applications and application data. Likewise, this version came with the first update for the Android Market application in the form of rearranged categories. The start screen would display the Applications, Games and Downloads columns, while inside each category there was the option of exploring the top paid, free or new applications.
Customizing the UI
Comparative to iOS and eventually Windows Phone, Android did not adopt a look of its own until relatively late. Earlier versions had a simple, utilitarian aspect and the graphics were, understandably, low resolution. In fact, many users and journalists at the time criticized it for having many of the icons and graphics inspired from early-2000s desktop operating systems.
At this stage in its life, a trend was started by phone companies that wanted to have their own look. HTC implemented Sense UI, one of the best user interfaces to that date, in order to make Android more user-friendly. Sony Ericsson then followed suit, bringing Timescape UI in Android 1.6 with Samsung realeasing TouchWiz soon after, an interface that is still evolving to this day.
However, it is worth mentioning that once a look had been standardized, Android did not have any overhauls until version 2.2 Froyo, with following versions, Gingerbread, Honeycomb and eventually Ice Cream Sandwhich, gradually introducing changes that would be focused on design.
Fig. 1.3 – From left to right, Sense UI, Timescape UI and TouchWiz
Moreso, versions 1.5 and 1.6 brought updates to many of the pre-installed applications. At that time, these applications were mainly part of the operating system and any change whatsoever would require an entire system update, opposed to now, with these operations handled through the Google Play Store. Until the end of 2009, Android would also make great progress in the fields of vocal recognition and text-to-speech.
Android 2.0 Eclair and Android 2.2 Froyo
Android 2.0 continued the development of key features like contacts and account synchronization for third-party applications, SMS and MMS search support or the double-tap to zoom gestures when using the browser. An update of this version, Android 2.1 brought live wallpapers and made small changes on performance level.
Android 2.2 or Froyo improved performance yet again due to it using JIT compilers, and laid the groundwork for Google Play Services, a component that would arrive two years later. Furthermore, the OS became more accessible for business related matters through support for Microsoft Exchange and the "Device Administrator" option for erasing data from the device, remotely. Also, it had default support for tethering and cloud messaging, thus creating new opportunities for developers.
Android on tablets
Due to the succes Apple had with the iPad, Android tried to take on this new-found market. At first, the transition from phone to tablet was slow. This was partly because most customers were hesitant about acquiring a tablet since there were not enough applications destined for this kind of devices, and as a consequence, developers held back on developing new applications for a market with almost no demand.
Samsung Galaxy Tab 7.0 was the first tablet to run on Android. This model was launched in September of 2010, with a personalized version of Android 2.2. It generally received good reviews although there were some problems with the operating system not being properly tailored to the device. In other words, the applications were not developed to enhance the physical characteristics of the tablet. The most common occurence was with applications not adapting to the new screen resolution and either overlaping the screen or not being centered. Additionally, there were some minor performance issues, too.
The Galaxy Tab had a 1024×600 pixels screen, not officially supported by Android, a 1GHz Hummingbird processor, 1.3 MP frontal camera and a PowerVR SGX540 graphics processing unit (GPU) that enabled high definition video playback. Also, the tablet could also be used as a phone.
Fig. 1.4 – Samsung Galaxy Tab 7.0
Still, despite initial relunctance from buyers, the tablet market exploded shortly after the release of the Galaxy Tab. One week after launch, Samsung announced sales of upwards of 600.000 units, with the 1.000.000 units treshold coming on December 4th 2010.
Successors of this model, the Galaxy Tab 2 7.0 and the Galaxy Tab 10.1 were budget oriented. Therefore, as the price became accessible not only for the high-end cosumers, specifications were lowered. Frontal camers now had VGA quality, the chipset used being a dual-core 1GHz OMAP4430 and the 5GHz frequency for wireless networks was dropped.
Android 2.3 Gingerbread and Android 3.0 Honeycomb
Launched in December of 2010, Android Gingerbread was the first major overhaul of the OS, bringing cutting edge technologies like NFC (near-field communication) and improving performance and application management. Additionally, the user interface was given a makeover to facilitate user interaction and minimize resources.
Unlike previous versions of Android, Gingerbread received updates for a long period of time. Mainly, this was due to the fact that version 3.0 Honeycomb was tablet-only, thus mobile carriers continued selling phones that ran on Android 2.3, making it a key target for developers for the next two years.
Fig. 1.5 – The updated interface of Android Gingerbread
Also in December of 2010, Android 3.0 Honeycomb, the specially engineered version of Android made for tablets, was launched. It would be the first, and also last of its kind. Up to that point, tablets were just oversized screens that ran on software designed for smartphones, and the new operating system was meant to pave the way for future versions. The interface had a holographic feel to it, suggestively named "Holo", with the colors black and blue predominant and an updated notification system.
Fig. 1.6 – Screenshot of Android 3.0
Android 4.0 Ice Cream Sandwich
Android 4.0 also upgraded the interface, while still adhering to the holographic standard set the previous version. Monotone white and grey tones were removed from the menu and a new font was introduced ,"Roboto", specially designed for high resolution screens, like the one Samsung had on their line of Nexus phones. Although the icons used had a futuristic design, they lacked the science-fiction style of Android Honeycomb.
This version in particular, placed a great deal of focus on details. Among others, all the lines and useless buttons were removed from the design and a few interface behaviours were implemented. For example, a flash of blue energy was added when scrolling to the end of a list, or a glowing outline when icons would be rearranged.
Fig 1.7 – Home screen and menu – Android 4.0
Furthermore, Ice Cream Sandwich brought common design elements to Google's own applications, like the action bar and overflow menus. These design traits would evolve over time, but the most important aspect of this version were the guidelines implemented by Google. Although it was unprecedented, this was done in order to aesthetically blend applications in the "Holo" ecosystem.
There were also changes regarding functionality. Following the trend set by tablets, smartphones now had buttons on the touchscreen. A specially dedicated button to switch between recent applications was added too, as more and more users used their phones for multi-tasking.
Google Play Store
One of the big changes to the Android OS came in 2012 with the reinvetion of the Android Market. Through the Play Store, Google wanted to unify all the services it provided, like Music and Books, which had their own applications, with the Android Market, to create one single application.
Also, designers used this occasion to launch a new interface. In the following years Google Play evolved, adding new features for users and developers alike. For instance, subscription services, in-application purchases and billing done by the mobile carrier. Google even tried for a short period of time selling their own Nexus devices and accessories through the Play Store, although all these transactions were later moved to a stand-alone application.
Fig. 1.8 – The updated aspect of Android Market, now Google Play
Services
Beside hosting applications, Google Play offers an online music platform, with a database of over 40.000.000 songs, the ability to store in the cloud up to 50.000 songs for free, and a paid subscription to the online streaming service, called Google Play Music available in 58 countries.
Likewise, Play Store houses the biggest online library in the world with over 4.000.000 copies. The books can be stored in the cloud or downloaded as a PDF or EPUB file. Moreover, they can be transferred to a number of devices that support Adobe eBook DRM and can be read online from any browser that has JavaScript enabled, through the Google Play Books application, and Chrome. At the moment, the service is available in 65 countries.
Google Play Movies & TV is available in 70 countries and gives access to hundreds of movies and television shows. The genres range from comedies and animated films to action, drama films and documentaries. This service can be used through the Google Play site or on a mobile device through the Android application. Certain productions could only be available for renting or purchase, while others could be available for renting and purchase alike.
Also, Google offers paid and unpaid subscribtions to thousands of news publications around the world, through their Google Play Newsstand service, available in 38 countries at the moment.
Play Store has also a service dedicated to Android gaming users through Google Play Games, enabling real-time multiplayer sessions, cloud saves, public leaderboards and an achievement section. According to Google, January through June of 2014, over 100.000.000 of new users registered for the service, thus becoming the fastest growing mobile gaming network of all time.
Google Play Services is a system-level application regularly updated in the background through the Play Store. As of April 2018, it has been installed more than five billion times on Android devices. Due to it having privileged access, it can scan applications while they're being installed, or block and delete phone data remotely, if necessary. It is also a key target for developers, to which the APIs (application programming interfaces) allow integration of Google Play Games, Google Fit or Android Wear. Initally, the application was available for all devices down to those running on Android 2.2 Froyo, though at the moment, this has been moved up to 2.3 Gingerbread .
Without Google Play Services, smartphones and other devices would have to wait for another version of Android to gain acces to new features. Hence, security threats would not be as easy to detect and patch. However, by keeping the security module and APIs outside of the "open-source" model, the risk of having thid-party appliactions or malevolent people gain acces to information was greatly reduced.
Android 4.1 Jelly Bean
From a mechanical point of view, Android had come a long way from its first version on the T-Mobile G1. Now, the second phase of development would focus on performance improvement. More precisely, reducing the execution time and resources needed to carry out any given task. The first steps towards this direction were made once Android 4.1, informally known as Jelly Bean, rolled around. The special attention this project got made version 4.1 the longest running Android version of all time, receiving updates from summer of 2012 to autumn of 2013.
For developers, new accessibility APIs were added, expanded language support with bi-directional text support and user-supplied keymaps, support for managing external input devices (video game controllers), and low-level access to hardware and software audio/video codecs.
In this version, the home screen was presented with new features like the ability of shortcuts and widgets to rearrange themselves when moving or resizing an item, and the notification system was improved, introducing the concept of "consumable" and "actionable" notifications.
Now that Android was regarded market leader in most countries around the world, aspect played a more important role. Fluid transitions, improved scrolling animations and an overall smoother visual experience were pivotal to this project. This was also the first version to introduce Google Now. By monitoring commonly input keyboard data from conversations or internet searches, Google Now would proactively deliver relevant results to the user, in the form of "cards". Specialized cards existed for birthdays, movies, nearby events or locations, sports, restaurant reservations and weather, among others. At the time, the feature was virtually praised, being named "Innovation of the year" for 2012, by Popular Science magazine.
Fig. 1.9 – Android 4.1 Screenshot
Android 4.4 KitKat
Version 4.4 was launched on October 31st 2013, and although it did not represent a total re-think of Android's visual style, it did present some changes. Translucent status bars and software keys opened up the large 5-inch screens of the time, and lighter, brighter colors throughout the UI made Android seem more approachable.
Moreover, the built-in application launcher was revised to incorporate Google Now to the leftmost panel of the home screen, underscoring thus the importance of predictive search to Google's vision of Android.
Starting with the foscus on visual improvement for Android 4.1, the main goal of this version was overall performance improvement, particularly on low-end devices. A special developing tool entitled "procstats" was engineered to analyze the random accessed memory for applications, especially those running background services. The collected data was then used to optimize and decouple the inefficent applications and programs.
Android 5.0 Lollipop
Android 5.0 Lollipop was launched in October of 2014 and it came with a radical change of style, having the "Holo" desing pattern replaced with "Material Design". This meant brighter colors, thinner fonts and a meticulously thought out design, with many grid-based layouts that built on the idea of folding layers of paper. Notifications could now be accesed from the lock screen and displayed inside applications as banners placed in the upper part of the screen. For the first time ever, design guidelines and thousand of new APIs were released to developers beforehand, through the "Android L" package.
Still, Android Lollipop did not bring changes only on a design level. The new "Tap and Go" setup process made it simpler to transition from one version of Android to another, "Guest" mode and pinned applications were developed for situations when somebody else other than the user would control the device and "Overview", the new multitasking view, made for a better way to switch between applications. Moreover, Google made internal changes, with Android Runtime (ART) officially replacing Dalvik, thus improving performance.
A number of system characteristics focused on separating personal and professional data were introduced as well, under the moniker "Android for Work". Furthermore, with the "Smart Lock" function, devices could be configurated to remain unlocked while in a certain location or connected to a specific Bluetooth device. Lollipop was also supposed to have built-in device encryption on all capable smartphones. However, due to performance related issues, this feature was postponed until the next version.
Fig. 1.10 – Android 5.0 Lollipop
Special attention was paid to optimizing energy comsumption. A new "Battery Saver" mode, job scheduling APIs which can restrict certain tasks to occur only over Wi-Fi and batching of tasks, to reduce the overall amount of time that internal radios are active, were all developed for this purpose. Moreso, a new developing tool called "Battery Historian" was added to monitor the energy consumption for each application.
Android 6.0 Marshmallow
Android 6.0 Marshmallow came in October 2015 and is to date the most popular single version of Android, running on 26.0% of the devices accessing Google Play. Rather than introduce a series of massive sweeping changes, the main focus of this version was to continue the progress from the previous version.
On a design level, Android 6.0 adheres to the "Material Design" guidelines. However, there are minor differences. For example, shortcuts to certain settings, now presented a miniature of the category rather than a default icon. The lock screen kept almost entirely the same layout except the bottom left shortcut which previously opened the "Call" application, now directed to "Vocal Search". Also, the application drawer was modified into a vertically scrollable list, compared to Lollipop's horizonatally scrollable pages and displayed the most used applications on top.
Perhaps the biggest improvement of version 6.0 was the redesigned permission-model. This meant applications were no longer automatically granted all of their permissions at installation time. Rather, an opt-in system was now used, in which users were prompted to grant or deny individual permissions (such as the ability to use a device's camera) when they are needed for the first time. The grants are remembered and can be revoked by the user at any time. However, the new model can only be used by applications developed for Marshmallow and onwards, with older applications retaing their all-or-nothing approach.
In addition, Marshmallow introduces new power management schemes known as "Doze" and "App Standby". The first identifies whether the phone is in use or not, in which case the device is put to sleep and the latter deactivates applications that have not been used recently.
However, perhaps the most unique feature of this version is Google Now on Tap. By long pressing the Home button, the application captures the currently displayed content and provides information about relevant keywords.
Fig. 1.11 – Google Now on Tap
This was also the version to feature device encryption, initially planned for version 5.0. For developers, Android Marshmallow provides native support for fingerprint recognition on supported devices via a standard API, allowing third-party applications to implement fingerprint-based authentication for unlocking devices and authenticating PlayStore and Google Pay purchases. Furthermore, it supported USB-C, including the ability to instruct devices to charge another device over USB.
Android 7.0 Nougat
Android 7.0 Nougat was officially released on August 22, 2016, with Google's Nexus devices being the first to receive the update. As of 16 April 2018, 30.8% of devices that access Google Play run on Nougat operating system, with 23.0% on Android 7.0 and 7.8% on its update, Android 7.1, thus making Nougat the most widely used Android version, overall.
On the user interface side, Nougat redesigned the notification shade, which now featured a smaller row of icons for settings, replacing notification cards with a new "sheet" design, and allowing inline replies for notifications. Moreover, this version introduced the concept of bundled notifications, and greater per-application control over notifications.
Fig. 1.12 – Android 7.0 Screenshot
Nougat introduced notable changes to the operating system and its development platform, including the ability to display multiple applications on-screen in a split-screen view, and an expanded power-saving mode. Additionally, system-level changes were made, with Java Runtime Environment switched from Apache Harmony to OpenJDK, utilizing now a just-in-time compiler and profiling, alongside its current ahead-of-time compiler, to further optimize applications.
This version also used for the first time "seamless", automatic updates, with the Android system running from an "online" partition, while updates are applied in the background, to a redundant "offline" partition.
Android 8.0 Oreo
Android 8.0 Oreo is the latest, and 15th version overall, of the Android operating system. It was first released as an alpha quality developer preview in March 2017 and released to the public on August 21, 2017.
It contains a number of major features, including notification grouping, picture-in-picture support for video playback, performance improvements and battery usage optimization, among others. Android Oreo also introduces two major platform features with Android Go, a software distribution of the operating system for low-end devices and support for implementing a hardware abstraction layer.
The aspect of the OS was kept mostly unchanged from previous versions, with a few minor changes. The "Settings" application features a new design, with a white theme and deeper categorization of different settings, while the ringtone, alarm and notification settings now contain an option for adding custom sounds to the list. The Android 8.1 update supports the display of battery percentages for connected Bluetooth devices, made the notification shade slightly translucent, and dimmed the on-screen navigation keys in order to reduce the possibility of screen burn.
Fig. 1.13 Picture-in-picture, in Android 8.0
With this version, the underlying architecture of Android was revised. Hence, low-level, vendor-specific code for supporting a device's hardware could now be separated from the Android OS framework, using a hardware abstraction layer known as the "vendor interface". Therefore, all devices shipping with Oreo must support a vendor interface, but this feature is optional for devices being updated to Oreo from an earlier version.
Android Oreo also adds support for Neighborhood Aware Networking (NAN) for Wi-Fi based on Wi-Fi Aware, Bluetooth 5, wide color gamuts in applications, an API for autofillers and low system-level integration for VoIP applications. Android Oreo contains additional limits on background activities in order to improve battery life.
The "seamless updates" system introduced in Android 7.0 was also modified to download update files directly to the system partition, rather than requiring them to be downloaded to the user partition first, thus reducing storage space requirements for system updates.
Other projects
Google Glass
Numerous companies have tried over the years to implement Android on devices other than smartphones or tablets. At the annual I/O conference in 2012, Google presented such a device, the Google Glass. Basically, it was a redemensioned Samsung Galaxy Nexus, slim enough to be supported by eyeglasses frames.
Fig. 1.14 – Google Glass
Communication with the device was done vocally with each command preceded by the formula "Ok, Glass!". The device had a touchpad on its side to easily browse through the interface and a prisma display offered the wearer access to notifications. The Google Glass was equipped with a video camera as well, that could take pictures and record at High Definition, 720p quality. The battery had a life cycle of about 24 hours.
The project did not materialize at a larger scale as the public had many complaints regarding violation of the right to privacy and safety. Nonetheless, the device is still available through the "Explorer" development program.
Android Wear
Unlike other projects, Android Wear was never meant to be open source. There are severeal reasons why Google chose this strategy, one of them being that Android Wear is mostly based on Google Play Services, a closed source project itself. By doing this, it prevented having companies that were not affiliated with Google develop watches and at the same time it eliminated the posibility of having devices that were not supported on the market. Still, authorized watchmakers could customize their design and the selection of pre-installed applications.
Fig. 1.15 – Android Wear concept
The first version of Android Wear, Android 4.4W, was almost entirely based on vocal commands, did not have quick access to the application drawer and had relatively limited support for applications. Instead, the device acted as a platform for displaying notifications and interacting with smartphone applications, over Wi-Fi or Bluetooth.
Although later versions would remedy those issues, the Android Wear line held during the first quarter of 2017 about 18% of the market share, a number that pales in comparison to Apple’s efforts, which took a whopping 57% of the market.
Android Auto
Patrick Brady, Vice President of Engineering at Google said that "In many ways our cars keep us connected to the physical worlds around us, but they remain disconnected from our other devices in our digital lives". Indeed, aside from basic Bluetooth connections, there had been very little for smartphone users to enjoy in the car.
With Android Auto, the smartphone is connected to the car's infotainment system and the output is sent to the car's display. Therefore, having the vast majority of the work being done on the phone means updates will be handled on Google Play and not on the vehicle side of things.
Fig. 1.16 – Android Auto
Android Auto enables drivers to have control over GPS navigation, media player, reading and sending text messages, making phone calls and browsing the web. Touchscreen control and through physical buttons in the car are both supported, although the focus is mainly on being hands-free with vocal commands, for a safer driving experience.
The first cars with Android Auto built-in started to roll out in 2015, most notably the Hyundai Sonata, other manufacturers following suit shortly after.
Android TV
Android TV is a platform for SMART TVs, based on versions 5.0 onwards. Through it, users have acces to Google Play Store, streaming services like Netflix and Hulu and even games. The platform focuses mainly on receiving vocal commands to instantly find relevant results. The user interface is divided into three sections: the upper section, for recommended content based on viewing habits, media applications in the middle and games in the lower section.
Fig 1.15 – Start screen, Android TV
Browsing can be done using a video game controller, a remote control or with a smartphone with the Android TV application installed. It also offers support for the Chromecast media player, to enable casting over LAN or Wi-fi.
The platform has been adopted as smart TV middleware by a number of companies including Sony, Sharp and VU TVs, while a partnership was made with Razer and Asus, to bring media players oriented towards a gaming experience.
Chapter 2. Android application development
System properties
Android Open Source
Android is best-known as an "open source" system. Consequently, source code can be downloaded and modified by literally anyone, which led to the creation of the AOSP (Android Open Source Project). Still, although the Android kernel is open-source, pre-installed Google applications are not. Once Google finished developing a new version, the code is released to anyone, from major companies to amateur developers, for them to create their personalized vesions.
Of course, there are some criteria that need to be met in order to ensure compatibility on all devices, found in the Android Compatibility Program. To get a Google licence and be able to user their services (PlayStore, Music, News etc.) developing companies must pass all the compatibility tests. This way, it is ensured that any application with access to the PlayStore is compatible with the rest of the applications in the store.
Programming language
Although Android, implemented on the Linux kernel, was coded mainly in C, the Android Software Development Kit (SDK) utilises a subset of specific Java libraries and more recently Kotlin, a specially developed programming language for Android. Therefore, Android does not use the Java virtual machine. Instead, it utilizes byte arrays as an intermediate step. Depending on the version, these are interpreted by either the Dalvik virtual machine, or compiled to native code by Android Runtime.
Application components
Programmable components
Activities
An Android application can constitute of one or more activities, with an activity defining the abstract container of both the user interface and the code behind it. An activity is an important part of an application's lifecycle, and the way they are launched and implemented is a fundamental aspect of the Android application model. Each activity is designed as an implementation of the base class Activity.
Activity lifecycle
Fig 2.1 – Activity lifecyle scheme
The complete activity lifecycle lasts from the call of the onCreate() method, to the call of the onDestroy() method. The activity makes all the necessary arrangements for running in onCreate(), and releases all the remaining resources in onDestroy(). The visible cycle takes place between the call of the onStart() and onStop() methods. During this time, the user can see the activity (although this also applies to activities that are not in the foreground – e.g. when the user interacts with a dialog window). The onStart() and onStop() methods can be called multiple times, depending on the visibility. The last cycle, the foreground lifecycle, starts when onResume() is called and it ends with onPause(). During this time, the activity is on top of other activities and interacts with the user. An activity usually goes through onResume() and onPause() multiple times and consequently, the code inside these methods should be optimal.
Intents
Intents are used to start and commute between activities, send data across activities and communicate with various components of the Android operating system. They consist of two things: a general action to be performed and the data on which the activity operates. Applications can either send or receive an intent. When an application sends an intent, a new activity or service is brought to the foreground, pausing the activity from which the intent was sent. In order for an activity to receive an intent, a broadcast receiver must be declared, which can register for an event and notify the activity if such an event transpires. (e.g. broadcast receivers to notify when a new email has arrived or system boot is complete).
Views
Views are a basic element of the Android user interface. They take up a rectangular space of the screen and are responsibile with handling events. There are several different kind of views, among them TextView (to display text variables), ImageView (to display images), Layout (for defining the layout of the user interface), or Button (to create buttons).
Asynchronous calls
The AsyncTask class, specific to asynchronous calls, is used to execute multiple operations simultaneously, without having to manually handle threads. In general, asynchronous task processing is required when an activity could demand more resources, for example, data communication over the internet, reading information from the storage device, and others. Failing to use asynchronous schedules for laborious tasks can cause the application to slow down, or worst scase scenario, to display the ANR dialog window (Application Not Responding), through which the user can select to either wait until the application becomes responsive again, or force close the application.
Toolbar (Actionbar)
Early Android phones used to have a physical menu button that would display a number of options for the user to choose from once pressed. This changed once Android 3.0 rolled around, when the physical menu button was dropped in favor of moving the options behind a button in the action bar.
Fig. 2.2 –Early YouTube actionbar
The back button on an action bar is always placed on the left, usually with the application's logo to the right and is responsible with going back one level, to the screen of the previous in-application activity. Although its functionality is same with the physical back button, Google encourages the practice of moving the back button to the action bar to prepare for the next generation of smartphone designs, with only one or no physical buttons at all.
Action buttons are always to the right, and their functionality usually range from sharing content or selecting options, to in-application searches. In general, they can either be text, icons or both, the developer having the posibility of adding however many actions, with those that don not fit the action bar being grouped in a overflow menu.
Notifications
Android applications can notify the user when certain events occur, like a possible update or receiving a message. Notifications are displayed on the device's status bar, and their behaviour can be defined by the developer. For instance, a notification can extend when pressed, to show more details or can trigger a new activity to which the user will be redirected. As of Android 7.0, notifications from the same appliction can be bundled. This means that by bundling notifications into a group, the user will be able to act on the entire group at once or expand the group and act on a individual notification in the group.
Hardware and software tools
Android devices are equipped with hardware tools that every developer can use. Still, in order to do that, certain lines must be added to the application's Android manifest. By doing this, when the application is installed, for previous Android versions, or when the application needs to access the tool for the first time, versions 6.0 and upwards, the user is alerted and can grant the access or not.
Touchscreen
A device's screen offers countless opportunities for developers to enhance user experience. They can use predefined gestures such as double-tap zoom, horizontal swipes on the screen for peeling to the next page, or create new gestures, specially tailored for their applications. Android also offers support for multitouch, to enable device control with more than one finger, simultaneously.
SD Card
The Android Operating System also offers necessary tools to access files for writing or reading from a device's memory card. This practice can be used to avoid overcrowding the already limited internal memory on some devices, with useless data.
Nevertheless, hardware tools are not the only available Android features, with the existence of software tools as well.
Internet access
With the ability of Android devices to connect to the internet, users have realtime access to terabytes of data. As a developer, this feature can be user to keep application data up to date, download new versions or back-up data to the cloud server. Moreover, laborious processes in terms of resources can be outsourced to a server for improving data processing time, a commonly occurring practice in software architecture.
Video and audio support
Most audio and video formats are supported by the operating system and including multimedia content in applications (sound effects, instructional videos, background music etc.) is something numerous applications available on the Google PlayStore have in common.
Google APIs
Google APIs or (Application Programming Interfaces) are a set of interfaces developed by Google and used when programming an application. Through them, developers can integrate services like Gmail, Firebase, Search, Translate or Google Maps into their applications. Said applications can either use these interfaces to take advantage of current services, or exend their functionality.
APIs also offer insights into usage statistics, the age group the application is most popular with or user data access, when such permission is granted.
XML files
XML or Extensible Markup Language, is a markup language used to annotate the content of a document. It defines a set of rules for encoding documents, in a format that is both human and machine-readable. The design goals of XML are to emphasize simplicity, generality and usability across the Internet.
It is also a textual data format with an important support via Unicode for multiple languages. Although XML design focuses on documents, it is especially used for arbitrary representations of data structures.
XML structure
XML documents can begin by declaring the version and encoding used as in the example: <?xml version="1.0" encoding="UTF-8"?>.
By definition, an XML document is a string of characters. Except for a few control characters, all Unicode characters can be used. In order to pass the structured information to the application, the bookmarks of the document are analyzed. These can be "signs" or "content," and can be distinguished by simple syntactic rules. Typically, character strings that either begin with the character "<" and end with ">", or begin with the "&" character and end with ";" are a sign. The rest of the strings that are not signs are considered content.
Tags are considered signs and can be one of three:
start-tag: <section>
end-tag: </section>
empty-element tag: <line-break />
Composing logical documents that begin with a start-tag and end with the corresponding end-tag, or consist of only one empty-element tag, are called elements (e.g: <Greeting>Hello, world.</Greeting>). The characters between the start-tag and end-tag, if present, are the element's content, and may contain markup, including other elements, which are called child elements.
An attribute is a markup construct of a name/value pair that exists within start or empty tags. In the example below, the img element has two attributes: src and alt:
<img src="madonna.jpg" alt='Foligno Madonna, by Raphael' />
AndroidManifest.xml
This XML file is fundamental to every Android application, by keeping track of all the resources needed to run the application. Hence, it provides information about the Java package used, application components (activities and background services), permissions or the minimum API level. The manifest also states the current application version, the versioning process needing at least a version code, although Google strongly suggests adding a version name too.
Version code is an integer value used to compare versions between them. This value is then used by other applications to determine the degree of compatibility, and by the PlayStore, which uses it as a basic value to identify the application and manage its updates. Therefore, the initial version can correspond to any integer value, but later versions must implicitly have values greater than the previous one.
Version name is a string value that represents the application version code, as displayed to the users. Similarly to the version code, the string can have any value, but usually consists of a structure <major>.<minor>.<point> (e.g. 2.1.1. or omitting the last value altogether, 2.1).
Permissions are lines of code that specify to the system the resources the application uses. These will be displayed the first time the application needs a particular resource with the user having the posibility to either grant or reject the permissions, case in which the application might not work properly.
Most commonly used permissions in Android application development are the following:
Android Projects
Configuring a new project
In order to develop Android applications, installing and configuring several tools is required:
Java SDK (software development kit), the basis for Android SDK;
Android SDK, for enabling access to Android libraries;
Android Studio or Eclipse IDE, programs tasked with bringing together the Java and Android SDK, and provide the application development environment.
Choosing a target version
Once the environment has been configured, it can be used to create new Android projects. The first step in Android application development is choosing a target version. With new additions every year, it is important for the developer to choose a correct target version around which the application is built, to ensure maximum availability across devices and best use of the developing tools. For instance, if the application requires developing tools from the most recent Android version, it will not run on the devices with older Android versions. Furthermore, Google encourages developers to support older versions in their applications, in order to ensure a better distribution of Android versions.
Each version has its own API and a market share. Versions 5.1, 6.0 and 7.0 are the most common, with the most recent version, 8.0 and its update 8.1, holding a 4.9% and 0.8% market share, respectively.
Fig. 2.4 – Android version market share, May of 2018
Project files and folders
In Android Studio, project files are organized by category, each having a specific folder (e.g. the AndroidManifest.xml file being it the manifests folder or .java source files in the java folder).
The res folder has all the files that act as a resource for the application (XML files). In turn, it can also have the following sub-folders:
** The resource files in the values folder usually are: arrays.xml (used for storing string and integers together), colors.xml (for defining color resources that can be accesed through the R.color class, dimens.xml (for defining dimensions, accessible through the R.dimen class), strings.xml (for defining strings, accessible through the R.string class) and styles.xml (for defining application themes, accessible through the R.style class).
Adding an activity
Android Studio gives the possibility of adding pre-programmed activities, such as the Google+ sign-in activity, Google Maps integration or the "full-screen" activity.
Fig. 2.4 – Activity structure in Android, the onCreate() method
The basis in every Android activity is the onCreate() method. In order for an application to function, this method must be overwritten. This is done through the super.onCreate(savedInstanceState)line. The parameter used, savedInstanceState, stores the state the application is in, to recreate it, if necessary. Removing this line will lead to a RuntimeException. Also inside this method, the interface of the activity is defined through the setContentView(R.layout.activity_main)line. In this example, activity_main is the XML file that contains all the data about the interface and therefore states to the system what resources to use and load onto the screen.
Once these steps are finalized, the developer can start the process of customizing the activity by adding methods and programs.
For data input, the declaration of an event listener is necessary, to track all the gestures on the touchscreen. Then, in order to generate a response from the application, an event handler must be declared. Thus, depending on the detected gesture (swipe up/down, double click, long click etc.), a certain behaviour can be triggered.
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: Disertatie Stoica Ionut – Tudorel [305524] (ID: 305524)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
