Xamarin Mobile Development for Android Cookbook

Book description

Over 80 hands-on recipes to unleash full potential for Xamarin in development and monetization of feature-packed, real-world Android apps

About This Book

  • Create a number of Android applications using the Xamarin Android platform
  • Extensively integrate your Android devices with other Android devices to enhance your app creation experience
  • A comprehensive guide packed with real-world scenarios and pro-level practices and techniques to help you build successful Android apps

Who This Book Is For

If you are a Xamarin developer who wants to create complete Android applications with Xamarin, then this book is ideal for you. No prior knowledge of Android development is needed, however a basic knowledge of C# and .NET would be useful.

What You Will Learn

  • Install and use Xamarin.Android with Xamarin Studio and Visual Studio
  • Design an app's user interface for multiple device configurations
  • Store and protect data in databases, files, and on the cloud
  • Utilize lists and collections to present data to the user
  • Communicate across the network using NFC or Bluetooth
  • Perform tasks in the background and update the user with notifications
  • Capture and play multimedia, such as video and audio, with the camera
  • Implement In-App Billing and Expansion Files and deploy to the store

In Detail

Xamarin is used by developers to write native iOS, Android, and Windows apps with native user interfaces and share code across multiple platforms not just on mobile devices, but on Windows, Mac OS X, and Linux.

Developing apps with Xamarin.Android allows you to use and re-use your code and your skills on different platforms, making you more productive in any development. Although it's not a write-once-run-anywhere framework, Xamarin provides native platform integration and optimizations. There is no middleware; Xamarin.Android talks directly to the system, taking your C# and F# code directly to the low levels.

This book will provide you with the necessary knowledge and skills to be part of the mobile development era using C#. Covering a wide range of recipes such as creating a simple application and using device features effectively, it will be your companion to the complete application development cycle.

Starting with installing the necessary tools, you will be guided on everything you need to develop an application ready to be deployed. You will learn the best practices for interacting with the device hardware, such as GPS, NFC, and Bluetooth. Furthermore, you will be able to manage multimedia resources such as photos and videos captured with the device camera, and so much more! By the end of this book, you will be able to create Android apps as a result of learning and implementing pro-level practices, techniques, and solutions. This book will ascertain a seamless and successful app building experience.

Style and approach

This book employs a step-by-step approach to Android app creation, explained in a conversational and easy-to-follow style. A wide range of examples are listed to ensure a complete understanding of how to deploy competent apps on the Android market.

Table of contents

  1. Xamarin Mobile Development for Android Cookbook
    1. Table of Contents
    2. Xamarin Mobile Development for Android Cookbook
    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. Errata
        3. Piracy
        4. Questions
    8. 1. Working with Xamarin.Android
      1. Introduction
      2. Creating Xamarin.Android projects
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Creating user interface layouts
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Creating an options menu
        1. How to do it...
        2. How it works...
      5. Supporting previous Android versions
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Adding an action bar
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Navigating with the action bar
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Adding action bar action items
        1. How to do it...
        2. How it works...
      9. Creating contextual action mode menu
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Creating contextual action mode menus
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      11. Sharing code with other platforms
        1. How to do it...
        2. How it works...
    9. 2. Showing Views and Handling Fragments
      1. Introduction
      2. Using custom views with layouts
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Creating and using fragments
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Preserving view and fragment state
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Navigating between fragments
        1. How to do it...
        2. How it works...
        3. See also
      6. Fragments and the action bar
        1. How to do it...
        2. How it works...
        3. See also
      7. Animating fragment navigation
        1. How to do it...
        2. How it works...
        3. See also
      8. Animating view and object properties
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Animating views on the UI
        1. How to do it...
        2. How it works...
        3. There's more...
      10. Adding a navigation drawer with fragments
        1. How to do it...
        2. How it works...
        3. See also
      11. Applying local styles and global themes
        1. How to do it...
        2. How it works...
    10. 3. Managing App Data
      1. Introduction
      2. Storing data with SharedPreferences
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Using files and the filesystem
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Reading bundled assets and resources
        1. How to do it...
        2. How it works...
        3. See also
      5. Parsing, processing, and generating XML
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      6. Accessing data with ADO.NET
        1. Getting ready...
        2. How to do it...
        3. How it works...
        4. See also
      7. Accessing data with SQLite.NET
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Encrypting databases with SQLCipher
        1. How to do it...
        2. How it works...
        3. See also
      9. Consuming content providers
        1. Getting ready...
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      10. Creating content providers
        1. How to do it...
        2. How it works...
        3. See also
      11. Backing up preferences and files to the cloud
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      12. Backing up data to the cloud
        1. Getting ready...
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    11. 4. Presenting App Data
      1. Introduction
      2. Implementing a ListView
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Using a SimpleAdapter
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Using custom ListView items
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Using a BaseAdapter with arbitrary data
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      6. Using a CursorAdapter
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Optimizing the ListView
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Enabling fast scrolling
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      9. Using section indexes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Integrating app searchability
        1. How to do it...
        2. How it works...
        3. There's more...
    12. 5. Communicating with the Outside World
      1. Introduction
      2. Consuming REST services with HttpClient
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Obtaining a network state
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Handling network state changes
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      5. Using DownloadManager
        1. How to do it...
        2. How it works...
        3. See also
      6. Accessing Bluetooth
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      7. Transferring data via Bluetooth
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Receiving NFC events
        1. Getting ready
        2. How to do it…
        3. How it works...
        4. There's more...
        5. See also
      9. Writing NFC tags
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      10. Transferring data via NFC
        1. How to do it...
        2. How it works...
      11. Obtaining location coordinates and addresses
        1. How to do it...
        2. How it works...
        3. There's more...
    13. 6. Using Background Tasks
      1. Introduction
      2. Asynchronous tasks
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      3. Starting services
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      4. Stopping services
        1. How to do it...
        2. How it works...
        3. See also
      5. Handling simultaneous service requests
        1. How to do it...
        2. How it works...
        3. See also
      6. Starting services automatically
        1. How to do it...
        2. How it works...
        3. See also
      7. Communicating with running services
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also
      8. Critical services
        1. How to do it...
        2. How it works...
        3. There's more...
    14. 7. Notifying Users
      1. Introduction
      2. Toasts
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Alert dialogs
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Alert fragments
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      5. Embedded alert fragments
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      6. Selection alerts
        1. How to do it...
        2. How it works...
      7. The notification builder
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Ongoing notifications
        1. Getting ready
        2. How to do it...
        3. How it works...
      9. Custom notification views
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      10. Push notifications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
    15. 8. Interacting with Other Apps
      1. Introduction
      2. Starting app components
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Launching other apps
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Obtaining data from activities
        1. How to do it...
        2. How it works...
      5. Using BroadcastReceivers
        1. How to do it...
        2. How it works...
      6. Scheduling tasks
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Making phone calls
        1. How to do it...
        2. How it works...
        3. There's more...
      8. Intercepting phone calls
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Sending SMS messages
        1. How to do it...
        2. How it works...
        3. There's more...
      10. Receiving SMS messages
        1. How to do it...
        2. How it works...
        3. There's more...
    16. 9. Presenting Multimedia
      1. Introduction
      2. Playing audio
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Playing audio in the background
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Managing the audio volume
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Recording an audio
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Playing a video
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Custom video controls
        1. How to do it...
        2. How it works...
      8. Using the camera
        1. How to do it...
        2. How it works...
      9. Creating a camera app
        1. How to do it...
        2. How it works...
        3. There's more...
      10. Handling high-resolution images
        1. How to do it...
        2. How it works...
      11. Drawing on the canvas of a View
        1. How to do it...
        2. How it works...
        3. There's more...
      12. Drawing on the canvas of a SurfaceView
        1. How to do it...
        2. How it works...
        3. There's more...
    17. 10. Responding to the User
      1. Introduction
      2. Responding to simple touches
        1. How to do it...
        2. How it works...
        3. There's more...
      3. Responding to scroll gestures
        1. How to do it…
        2. How it works...
        3. There's more...
      4. Responding to manipulation gestures
        1. How to do it...
        2. How it works...
      5. Detecting rotate gestures
        1. How to do it...
        2. How it works...
      6. Responding to custom user gestures
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Listening to sensor data
        1. How to do it...
        2. How it works...
      8. Listening for sensor triggers
        1. How to do it...
        2. How it works...
      9. Discovering the environment
        1. How to do it...
        2. How it works...
      10. Detecting device shakes
        1. How to do it...
        2. How it works...
        3. There's more...
    18. 11. Connecting to Wearables
      1. Introduction
      2. Introducing wearable notifications
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Customizing wearable notifications
        1. How to do it...
        2. How it works...
        3. There's more...
      4. Creating wearable apps
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      5. Creating always-on wearable apps
        1. How to do it...
        2. How it works...
      6. Creating dynamic always-on wearable apps
        1. How to do it...
        2. How it works...
      7. Communicating with wearables
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      8. Building watch faces
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      9. Configuring watch faces
        1. How to do it...
        2. How it works...
        3. There's more...
    19. 12. Adding In-App Billing
      1. Introduction
      2. Preparing for in-app billing
        1. Getting ready
        2. How to do it...
        3. How it works...
      3. Integrating in-app billing
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Listing available products
        1. How to do it...
        2. How it works...
        3. There's more...
      5. Purchasing products
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Listing purchased products
        1. How to do it...
        2. How it works...
      7. Consuming purchases
        1. How to do it...
        2. How it works...
    20. 13. Publishing Apps
      1. Introduction
      2. Protecting the content
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
      3. Protecting the code
        1. Getting ready
        2. How to do it...
        3. How it works...
      4. Preparing the app package
        1. How to do it...
        2. How it works...
      5. Shrinking the app package
        1. How to do it...
        2. How it works...
        3. There's more...
      6. Creating the app package
        1. How to do it...
        2. How it works...
        3. There's more...
      7. Uploading the app package
        1. Getting ready
        2. How to do it...
        3. How it works...
      8. Adding preview testers
        1. How to do it...
        2. How it works...
        3. There's more...
      9. Releasing for production
        1. Getting ready
        2. How to do it...
        3. How it works...
      10. Updating the app
        1. Getting ready
        2. How to do it...
        3. How it works...
    21. Index

Product information

  • Title: Xamarin Mobile Development for Android Cookbook
  • Author(s): Matthew Leibowitz
  • Release date: November 2015
  • Publisher(s): Packt Publishing
  • ISBN: 9781784398576