Android Quick APIs Reference

Android Quick APIs Reference By Onur Cinar

Download

Introduction

Chapter 1: Android Platform
This first chapter of the book covered the fundamentals of the Android platform. As indicated earlier in this chapter, you will not be directly interfacing with most of the core components that are presented in the section “Platform Architecture,” although knowing these components will make it easier for you to understand the Android framework functions that will be covered in the next few chapters.

Chapter 2: Development Environment
The Android platform provides a comprehensive development toolchain for application developers. In this chapter, you have learned how to successfully set up the Android development environment, including creating, building, and running an Android application on both the attached Android device and the Android emulator instance. The next chapter will go through the anatomy of an Android application. 

Chapter 3: Application Components
In this section you have learned about the fundamental components that the Android framework provides, such as activities, services, and content providers. Knowing how to use these components properly is the key for developing successful Android applications. In the next chapter, you will be learning about the UI components that the Android framework provides.

Chapter 4: Application Resources 
In this section I described how to attach various resources to your Android application. Through the list of configuration qualifiers provided in this chapter, you can obtain an alternative set of resources within the same application to cover more device configurations. Android provides a comprehensive resource management framework that can automatically find the best resource for a device configuration and also update it in real time when it detects a device configuration change. In the next chapters, you will learn how to use the attached resources with the UI components.

Chapter 5: Layouts and Views 
This chapter provided a brief overview of the APIs provided by the Android framework for developing extensive user interfaces on the Android platform. As the Android ecosystem is highly fragmented due to various display sizes and densities, the chapter started by exploring the various layout types that are provided by the Android framework in order to provide a fluid user interface that can adapt to any display size. The chapter also gave an overview of the input and output controls provided by the Android framework. The Fragment API was introduced at last, to allow the parts of a user interface to be broken down into modular and reusable pieces that can be used in different parts of the application.

Chapter 6: User Interface
This chapter provided a brief overview of the APIs that are employed by the Android framework to benefit from base window features, such as the action bar, toasts, dialogs, and notifications. The action bar is part of every Android application starting from API Level 11. It delivers a consistent way to provide identification about the application and a prominent place to list import application actions. Toasts and dialogs provide a way to launch a pop-up window to deliver notification to the user, and also to prompt the user for information while the application is still in the foreground. In a similar way, notifications allow applications to notify the user while the application is backgrounded. Once the notification gets posted for displaying in the notification area, the Android platform also propagates the notification to connected devices, such as smart watches. Proper use of these window features improves the user experience and provides a consistent way for users to interact with Android applications.

Chapter 7: Storing Data
This chapter explored the different storage options that are provided by the Android framework. As explained in this chapter, using simple files for storing data is the most generic storage option, although it does require a substantial amount of coding to handle both serializing and deserializing the data as plain files. Shared preferences is an Android-specific storage option for data that can be stored as key-value pairs. This storage option is the suggested format to store preferences data. The Android framework provides UI components to enable application developers to quickly produce settings screens on top of shared preferences. Finally, we explore SQLite database, the most advanced solution as a storage option for relational data. Compared to the other two storage options, the SQLite database allows the application to specify the format in which the data should be stored using database schemas. Later the application can manipulate and retrieve data from the relational database by simply executing SQL queries. The lifespan of the data stored on the device is tied to the lifespan of the device and operating system lifespans. The application data is not automatically restored when the user does a device reset, or simply upgrades to a new device. We explore Android Backup Service in the final section as a cloud-based solution to back up and restore application data

Chapter 8: Sensors and Location
The Android platform provides environmental and location information to applications. The SensorManager API is used to interact with built-in sensors on the Android device. The sensor API provided by the Android framework is a generic API. Sensor events should be interpreted based on sensor type. Applications are expected to unregister receiving sensor events when needed, in order to conserve battery power on the device. Location support is provided through the LocationManager API. The Android platform supports various location providers, such as the GPS provider and the network provider. Due to privacy concerns, an application is expected to have certain permissions defined in order to access these location providers. The application can receive the user’s current location in different ways based on the use case. The LocationManager also provides the last known location information to applications in order to compensate the latency of receiving the first location fix from a location provider 

Chapter 9: Media and Camera
This section briefly explored the multimedia support provided by the Android platform. Android differentiates between audio streams based on their purpose and allows each of these stream groups to be controlled individually for a superior user experience. AudioManager provides APIs to tune different aspects of each of these audio streams, as well as the audio input and output components of the device. Audio playback has various use cases and also unique challenges. The Android platform provides various APIs to address the most frequent use cases. The MediaPlayer API allows the application to play media streams with fine control. Meanwhile, the SoundPool API allows the application to pre-load the small and frequently used audio samples into memory for low-latency playback. The Android framework also provides the MediaRecorder API for recording both audio and video stream from various sources. At last, the chapter also provides a brief overview of the new Camera API that is provided with the Android 5.0 Lollipop version (API Level 21).
Share This