You are previewing Mastering Android Application Development.
O'Reilly logo
Mastering Android Application Development

Book Description

Learn how to do more with the Android SDK with this advanced Android Application guide which shows you how to make even better Android apps that users will love

About This Book

  • Learn how to design and build better Android apps to reach new users

  • Explore the latest features and tools in the Android SDK that will help you become a better developer

  • From concurrency to testing – through to adding adverts and billing, this book ties together every element to help you deliver a high-quality Android application on Google Play

  • Who This Book Is For

    Mastering Android Application Development is intended for Android developers that want insight on and guidance through the steps they need to take to give their creations the edge in a competitive market.

    What You Will Learn

  • Create an Android project with Android M features

  • Design the basic navigation for our app using the UI components

  • Set up a cloud-based platform and store data on it

  • Implement programming patterns such as Singleton and Observer to maintain your project code for future use

  • Display lists and grids using Android RecyclerView

  • Implement user interface components and make your app look professional

  • Handle, download, and store images along with memory management

  • Create the database and content providers to perform read-write operations

  • Add notifications to the app and analytics to track the user’s usage

  • Show a Google map view on your app

  • Configure minify to obfuscate the code

  • Add adverts and create products for purchase in your app

  • In Detail

    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!

    Style and approach

    This is a step-by-step guide where theory and practice are merged in a way that helps you to put a new concept into practice with ease. By helping to focus on the end result, and showing all the technical steps you need to get there, you will be poised for development success!

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Mastering Android Application Development
      1. Table of Contents
      2. Mastering Android Application Development
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why subscribe?
          2. Free access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Downloading the color images of this book
          3. Errata
          4. Piracy
          5. Questions
      8. 1. Getting Started
        1. Introducing Material Design
        2. Introducing Android 6 Marshmallow
          1. Runtime permissions
          2. Power-saving optimizations
          3. Text selection
          4. Fingerprint authentication
          5. Direct share
        3. Creating MasteringAndroidApp
        4. Getting the tools ready
        5. Summary
      9. 2. Designing our App
        1. Selecting an app-navigation pattern
          1. Basic structure
          2. The dashboard pattern
          3. The sliding panel
          4. Tabs
        2. Fragments
          1. Understanding the importance of fragments
          2. The Fragment Manager
          3. Fragments stack
        3. ViewPager
          1. Adapter
          2. Sliding tabs
          3. Customizing tabs
        4. Transitions
        5. Summary
      10. 3. Creating and Accessing Content from the Cloud
        1. Creating your own cloud database
          1. Parse
          2. Adding the Parse SDK to our project
          3. Android's Application class
          4. Creating the database
        2. Storing and consuming content from Parse
          1. Storing content
          2. Consuming content
          3. Displaying content
        3. Google Volley and OkHttp
          1. Google Volley
          2. OkHttp
          3. A lightning-fast network
        4. JSON and Gson
        5. Summary
      11. 4. Concurrency and Software Design Patterns
        1. Concurrency in Android
          1. Handlers and threads
          2. Introducing AsyncTasks
          3. Understanding services
            1. A type of service – IntentService
          4. Introducing loaders
        2. The importance of patterns
          1. The Singleton pattern
            1. Singleton in the Application class
          2. The Observer pattern
          3. Introducing the Adapter pattern
        3. Summary
      12. 5. Lists and Grids
        1. Starting with lists
          1. Using ListViews with built-in views
          2. Creating a custom Adapter
          3. Recycling views
          4. Applying the ViewHolder pattern
        2. Introducing RecyclerView
          1. Using list, grid, or stack
          2. Implementing RecyclerView
          3. Clicking on RecyclerView items
        3. Summary
      13. 6. CardView and Material Design
        1. CardView and UI design tips
          1. Introducing CardView
          2. Design-time layout attributes
          3. Working with custom fonts in Android
        2. The design support library
          1. Introducing TabLayout
          2. Toolbar, action bar, and app bar
          3. Adding motion with CoordinatorLayout
          4. Back navigation and up navigation
        3. Summary
      14. 7. Image Handling and Memory Management
        1. Downloading images
          1. The traditional way of downloading images
          2. Downloading images with Volley
          3. Introducing Picasso
        2. Mastering images
          1. Vector drawables
          2. Animating with AnimatedVectorDrawable
          3. Working with the nine patch
        3. Memory management
          1. Detecting and locating leaks
          2. Preventing leaks
            1. Activity and context references
            2. Using WeakReference
        4. Summary
      15. 8. Databases and Loaders
        1. Creating the database
          1. The database contract
          2. The database open helper
          3. Database Access Object
            1. Performing a query
            2. Using a raw query
            3. Introducing cursors
        2. Content providers
        3. Sync database with UI
          1. Implementing CursorLoader
          2. RecyclerView and CursorAdapter
          3. Introducing pull to refresh with SwipeRefreshLayout
        4. Summary
      16. 9. Push Notifications and Analytics
        1. Push notifications
          1. Sending and receiving notifications using GCM
          2. Push notifications with Parse
          3. Using NotificationCompat
        2. The importance of analytics
          1. Analytics with Parse
          2. The error report
        3. Summary
      17. 10. Location Services
        1. Configuring the project
          1. Getting the API key
            1. Displaying the debug certificate fingerprint
            2. Creating a Google Developer Console project
          2. Configuring AndroidManifest.xml
        2. Adding the map
          1. Adding the fragment
          2. Implementing MapFragment
        3. Adding a marker
          1. Retrieving data from Parse
          2. Displaying a marker for each location
          3. Adding a title to a marker
        4. Summary
      18. 11. Debugging and Testing on Android
        1. Logs and the debug mode
          1. Working with logs
            1. Using Timber, the log wrapper
          2. Debugging our app
        2. Testing on Android
          1. Unit tests with Robolectric
            1. Robolectric configuration
            2. Our first unit test
            3. Running unit tests
          2. Integration tests with Espresso
            1. Espresso configuration
            2. Writing an integration test
            3. Running integration tests
        3. Testing from a UI perspective
          1. Launching The Monkey
          2. Recording UI tests with MonkeyTalk
        4. Continuous integration
        5. Summary
      19. 12. Monetization, the Build Process, and Release
        1. Using build variants
          1. Creating build types
          2. Product flavors
        2. Monetization in Android
          1. Key points in advertisement monetization
          2. Adding advertisements with AdToApp
        3. Releasing our app to Play Store
          1. Code obfuscation
          2. Exporting the app
          3. Uploading our app to Play Store
            1. Creating a publisher account
            2. The Google Play Developer console
            3. Publishing an app
            4. Uploading the APK file
            5. Preparing the store listing
        4. Summary
      20. Index