![]()
Mastering Android Application Development
Table of Contents
Mastering Android Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Getting Started
Introducing Material Design
Introducing Android 6 Marshmallow
Runtime permissions
Power-saving optimizations
Text selection
Fingerprint authentication
Direct share
Creating MasteringAndroidApp
Getting the tools ready
Summary
2. Designing our App
Selecting an app-navigation pattern
Basic structure
The dashboard pattern
The sliding panel
Tabs
Fragments
Understanding the importance of fragments
The Fragment Manager
Fragments stack
ViewPager
Adapter
Sliding tabs
Customizing tabs
Transitions
Summary
3. Creating and Accessing Content from the Cloud
Creating your own cloud database
Parse
Adding the Parse SDK to our project
Android's Application class
Creating the database
Storing and consuming content from Parse
Storing content
Consuming content
Displaying content
Google Volley and OkHttp
Google Volley
OkHttp
A lightning-fast network
JSON and Gson
Summary
4. Concurrency and Software Design Patterns
Concurrency in Android
Handlers and threads
Introducing AsyncTasks
Understanding services
A type of service – IntentService
Introducing loaders
The importance of patterns
The Singleton pattern
Singleton in the Application class
The Observer pattern
Introducing the Adapter pattern
Summary
5. Lists and Grids
Starting with lists
Using ListViews with built-in views
Creating a custom Adapter
Recycling views
Applying the ViewHolder pattern
Introducing RecyclerView
Using list, grid, or stack
Implementing RecyclerView
Clicking on RecyclerView items
Summary
6. CardView and Material Design
CardView and UI design tips
Introducing CardView
Design-time layout attributes
Working with custom fonts in Android
The design support library
Introducing TabLayout
Toolbar, action bar, and app bar
Adding motion with CoordinatorLayout
Back navigation and up navigation
Summary
7. Image Handling and Memory Management
Downloading images
The traditional way of downloading images
Downloading images with Volley
Introducing Picasso
Mastering images
Vector drawables
Animating with AnimatedVectorDrawable
Working with the nine patch
Memory management
Detecting and locating leaks
Preventing leaks
Activity and context references
Using WeakReference
Summary
8. Databases and Loaders
Creating the database
The database contract
The database open helper
Database Access Object
Performing a query
Using a raw query
Introducing cursors
Content providers
Sync database with UI
Implementing CursorLoader
RecyclerView and CursorAdapter
Introducing pull to refresh with SwipeRefreshLayout
Summary
9. Push Notifications and Analytics
Push notifications
Sending and receiving notifications using GCM
Push notifications with Parse
Using NotificationCompat
The importance of analytics
Analytics with Parse
The error report
Summary
10. Location Services
Configuring the project
Getting the API key
Displaying the debug certificate fingerprint
Creating a Google Developer Console project
Configuring AndroidManifest.xml
Adding the map
Adding the fragment
Implementing MapFragment
Adding a marker
Retrieving data from Parse
Displaying a marker for each location
Adding a title to a marker
Summary
11. Debugging and Testing on Android
Logs and the debug mode
Working with logs
Using Timber, the log wrapper
Debugging our app
Testing on Android
Unit tests with Robolectric
Robolectric configuration
Our first unit test
Running unit tests
Integration tests with Espresso
Espresso configuration
Writing an integration test
Running integration tests
Testing from a UI perspective
Launching The Monkey
Recording UI tests with MonkeyTalk
Continuous integration
Summary
12. Monetization, the Build Process, and Release
Using build variants
Creating build types
Product flavors
Monetization in Android
Key points in advertisement monetization
Adding advertisements with AdToApp
Releasing our app to Play Store
Code obfuscation
Exporting the app
Uploading our app to Play Store
Creating a publisher account
The Google Play Developer console
Publishing an app
Uploading the APK file
Preparing the store listing
Summary
Index
![]()
Mastering Android Application Development
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author(s), nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2015
Production reference: 1231015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78588-422-1
www.packtpub.com
![]()
Author
Antonio Pachón Ruiz
Reviewers
BJ Peter DeLaCruz
Kyrre Havik Eriksen
Ankit Garg
Commissioning Editor
Veena Pagare
Acquisition Editor
Reshma Raman
Content Development Editor
Rashmi Suvarna
Technical Editor
Parag Topre
Copy Editor
Shruti Iyer
Project Coordinator
Judie Jose
Proofreader
Safis Editing
Indexer
Monica Ajmera Mehta
Graphics
Disha Haria
Abhinash Sahu
Production Coordinator
Conidon Miranda
Cover Work
Conidon Miranda
![]()
Antonio Pachón Ruiz is a software engineer with a master's degree in mobile technologies. He has more than five years of experience working as an Android developer and has developed a large number of apps.
Antonio was born in southern Spain and currently lives in London working as an Android contractor; he works part time developing for different companies, such as TomTom, MasterCard, and the UK giant, British Telecom. His experience extends from small start-ups to big telecom companies. Video streaming apps, newsreader apps, Voice over IP, voice authentication, e-commerce, online payments, navigation, and games are some of the technologies Antonio has worked on.
He is also the director of SuitApps, a venture outsourcing apps remotely for other companies, where he leads and coaches a ...