Book Image

Mastering Android Application Development

By : Antonio Pachon
Book Image

Mastering Android Application Development

By: Antonio Pachon

Overview of this book

There are millions of Android apps out there for people to download – how do you make sure yours has the edge? It’s not always about innovation and ideas – the most successful apps are those that are able to satisfy customer demands – they’re the ones that look the best, the fastest, and the easiest and most intuitive to use. This book shows you how to create Android applications that do precisely that – it has been designed help you consider and answer those questions throughout the development process, so you can create applications that stand out against the crowd. Learn how to create exemplary UIs that contribute to a satisfying user experience through the lens of Material Design, and explore how to harness the range of features within the Android SDK to help you. Dive deeper into complex programming concepts and discover how to leverage concurrency and navigate memory management and image handling. You’ll also find further guidance on testing and debugging so you can guarantee that your application is reliable and robust for users. Beyond this you’ll find out how to extend your app and add greater functionality, including notifications, location services, adverts and app billing (essential if you want to properly monetize your creation!). To make sure you have confidence at every stage in the process, the book also shows you how to release your app to the Play store – to make sure your maximising your efforts to create a popular Android application!
Table of Contents (19 chapters)
Mastering Android Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

This book is a practical guide to learning the development of advanced Android apps. This book helps master the core concepts of Android and quickly apply the knowledge in real-life projects. Throughout the book, an app is created, evolved in every chapter, so that the reader can easily follow and absorb the concepts.

The book is divided into twelve chapters. The first three chapters are focused on the design of the app, explaining the basic concepts of design and the programming patterns used in Android. The next few chapters aim to improve the application, accessing the server side to download the information to be shown in the app. Once the app is functionally complete, it is improved using Material Design components and other third-party libraries.

Before finishing, extra services are added to the app, such as location services, analytics, crash reports, and monetization. Finally, the app is exported, explaining the different build types and certificates, and uploaded to Play Store, ready to be distributed.

What this book covers

Chapter 1, Getting Started, explains the basics of Android 6 Marshmallow and important concepts of Material Design. We will set up the tools needed to start developing and, optionally, we will install an ultrafast emulator that is quicker than the Android default one, which will help us test our app along the book.

Chapter 2, Designing our App, introduces the first step of creating an app—designing the navigation— and the different navigation patterns. We will apply the Tabs pattern with sliding screens, explaining and using Fragments, which is a key component in the Android app development.

Chapter 3, Creating and Accessing Content from the Cloud, covers all that is necessary to display information from the Internet in our app. This information can be on an external server or API. We will create our own server using Parse, and we will access it with advanced network requests using Volley and OKHttp, processing the information and converting it into usable objects using Gson.

Chapter 4, Concurrency and Software Design Patterns, talks about concurrency in Android and the different mechanisms to handle it, such as AsyncTask, Services, Loaders, and more. The second part of this chapter talks about the most common programming patterns used in Android.

Chapter 5, Lists and Grids, discusses lists and grids, starting with ListViews. It explains how this component evolved in RecyclerView, and as an example, it shows how to create a list with different types of elements on it.

Chapter 6, CardView and Material Design, focuses on improving the app from a user interface perspective and introduces Material Design, explaining and implementing features such as CardView, Toolbar, and CoordinatorLayout.

Chapter 7, Image Handling and Memory Management, mostly talks about displaying images in our app that are downloaded from the Internet using different mechanisms such as Volley or Picasso. It also covers different types of images, such as Vector Drawable and Nine patch. Finally, it talks about memory management and preventing, detecting, and locating memory leaks.

Chapter 8, Databases and Loaders, essentially explains how databases work in Android, what content providers are, and how to get the database to communicate directly with the views using CursorLoaders.

Chapter 9, Push Notifications and Analytics, talks about how to implement push notification using Google Cloud Messaging and Parse. The second part of the chapter talks about analytics, which is critical to understand how users behave with our app, to capture error reports, and to keep our app free of bugs.

Chapter 10, Location Services, introduces MapView by implementing an example in the app from the initial setup in the developer console to the final map view in the app showing locations markers.

Chapter 11, Debugging and Testing on Android, talks mostly about testing. It covers unit test, integration, and user interface tests. It also discusses using different tools and best practices on the market to develop a maintainable app through automated tests.

Chapter 12, Monetization, the Build Process, and Release, shows how to monetize the app and explains the key concepts of advertisement monetization. It shows how to export an app with different build types and, finally, how to upload and market this app in Google Play Store.

What you need for this book

Your system must have following software to execute the code mentioned in this book:

  • Android Studio 1.0 or later versions

  • Java 1.7 or later versions

  • Android 4.0 or later versions

Who this book is for

If you are a Java or project developer with some experience in Gradle and want to become an expert, then this book is for you. Basic knowledge of Gradle is essential.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames and dummy URLs are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> 

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from http://www.packtpub.com/sites/default/files/downloads/4221OS_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.