You are previewing Mastering Cross-Platform Development with Xamarin.
O'Reilly logo
Mastering Cross-Platform Development with Xamarin

Book Description

Master the skills required to steer cross-platform applications from drawing board to app store(s) using Xamarin

About This Book

  • Develop your Xamarin development skills with this comprehensive guide on various patterns and features so you can create elegant and high-quality applications

  • Create adaptive user interfaces on separate platforms without compromising the user experience and platform identity

  • Implement application lifecycle management concepts to manage and finalize cross-platform projects and efficiently collaborate with others

  • Who This Book Is For

    This book is ideal for those who want to take their entry–level Xamarin mobile development skills to the next level to become the go-to person within their organization. To fully understand the patterns and concepts described, you should possess a reasonable level of knowledge about the core elements of Xamarin and cross-platform application development with it.

    What You Will Learn

  • Configure your environment for cross-platform projects with Xamarin

  • Gain memory management skills to avoid memory leaks and premature code cycles while decreasing the memory print of your applications

  • Employ asynchronous and parallel patterns to execute non-interactive and non-blocking processes

  • Create and use SQLite databases for offline scenarios

  • Integrate network resources with cross-platform applications

  • Design and implement eye-catching and reusable UI components without compromising nativity in mobile applications

  • Manage the application lifecycle of cross-platform development projects

  • Distribute Xamarin applications through public or private channels

  • In Detail

    The main goal of this book is to equip you with the required know-how to successfully analyze, develop, and manage Xamarin cross-platform projects using the most efficient, robust, and scalable implementation patterns.

    This book starts with general topics such as memory management, asynchronous programming, local storage, and networking, and later moves onto platform-specific features. During this transition, you will learn about key tools to leverage the patterns described, as well as advanced implementation strategies and features. The book also presents User Interface design and implementation concepts on Android and iOS platforms from a Xamarin and cross-platform perspective, with the goal to create a consistent but native UI experience.

    Finally, we show you the toolset for application lifecycle management to help you prepare the development pipeline to manage and see cross-platform projects through to public or private release.

    Style and approach

    This is a comprehensive guide on various Xamarin features and patterns. Each topic is explained and demonstrated with code samples, which are revised in each section in an iterative manner and analyzed with available diagnostic tools to demonstrate the benefits of different patterns.

    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 Cross-Platform Development with Xamarin
      1. Table of Contents
      2. Mastering Cross-Platform Development with Xamarin
      3. Credits
      4. About the Authors
      5. About the Reviewers
      6. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      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. Developing with Xamarin
        1. Cross-platform projects with Xamarin
          1. Xamarin as a platform
          2. Xamarin as a product
        2. Target platforms
          1. Xamarin on Android
          2. Xamarin on iOS
          3. Windows Runtime apps
        3. Setting up the development environment
          1. Choosing the right development OS
            1. Xamarin Studio setup and configuration
            2. Visual Studio setup and configuration
        4. Emulator options
          1. Emulators for Android
          2. iOS emulation
        5. A typical Xamarin solution structure
          1. Portable class libraries
          2. Shared projects
          3. Xamarin.Forms
          4. NuGet packages
          5. Components
        6. Quality in cross-development
          1. Reusability
          2. Abstraction
          3. Loose-coupling
          4. Nativity
        7. Summary
      9. 2. Memory Management
        1. Application Component lifecycle
          1. Activity lifecycle (Android)
            1. Active/Running
            2. Paused
            3. Backgrounded
            4. Stopped
            5. Restarted
          2. Application lifecycle (iOS)
        2. Garbage collection
          1. GC on Xamarin projects
            1. SGen garbage collector
            2. Boehm garbage collector (iOS only)
        3. Platform-specific concepts
          1. Object reference types
          2. Automatic Reference Counting (ARC)
        4. Troubleshooting and diagnosis
          1. Xamarin Profiler
            1. Allocations instrument
            2. Time Profiler
          2. Device Monitor (Android only)
          3. Instruments (iOS only)
          4. Monotouch Profiler (iOS only)
        5. Patterns and best practices
          1. Disposable objects
          2. The lapsed listener problem
          3. Weak references
          4. Cross-domain objects
          5. Cyclic references (cycles)
        6. Summary
      10. 3. Asynchronous Programming
        1. Multithreading on Xamarin
          1. Single thread model
          2. Task-based Asynchronous Pattern
          3. Concurrency model on iOS
        2. Asynchronous methods
          1. Continuation
          2. Cancellation
          3. Progress
          4. Task batches
        3. Parallel execution
        4. Patterns and best practices
          1. Async pattern conversions
          2. Multi-threading with tasks
          3. Exception handling
          4. Initialization pattern
          5. Semaphores
        5. Background tasks
          1. Background tasks on iOS
          2. Services (Android only)
        6. Summary
      11. 4. Local Data Management
        1. Data in mobile applications
          1. State
          2. App data
          3. Local files
          4. External data
        2. Application data
          1. Installation directory
            1. Android
            2. iOS
          2. Local storage
            1. Android
            2. iOS
          3. Temporary storage
        3. Local filesystem
        4. SQLite
        5. Patterns and best practices
          1. Application preferences
          2. File picker
        6. Backup/Roaming
          1. Android and Backup API
          2. iOS and ubiquitous storage
        7. Summary
      12. 5. Networking
        1. Connected apps
        2. Web services
          1. Transport
          2. Messaging
          3. SOAP/XML services
          4. RESTful services
          5. OData and OAuth
            1. OData
            2. OAuth
        3. SignalR
        4. Patterns and best practices
          1. Async conversions
          2. Data model abstraction
          3. Service cache
        5. Platform-specific concepts
          1. Permissions
          2. NSUrlConnection/NSUrlSession (iOS Only)
          3. Background downloads
          4. Push notifications
        6. Cloud integration
          1. Azure Mobile Services
          2. Azure offline data
          3. Azure authentication
        7. Summary
      13. 6. Platform Extras
        1. Content sharing
          1. File pickers and contracts (Windows Store apps)
          2. Document Provider extensions (iOS)
          3. ContentProvider and ContentResolver (Android)
        2. Peripherals
          1. Bluetooth
          2. Wi-Fi Direct
          3. Near Field Communication
        3. Location data
          1. Android location and Google Play services
          2. Location services on iOS
          3. Location data on Windows Runtime
          4. Geofencing
        4. Native libraries
          1. Managed callable wrappers (Android)
          2. Linking versus binding (iOS)
        5. Summary
      14. 7. View Elements
        1. Design philosophy
          1. User expectations
          2. Platform imperatives
          3. Hardware dependency
            1. Design metrics on Android
              1. Design metrics on iOS
              2. Design metrics on Windows Runtime
        2. Design elements
          1. The basic layout
          2. Navigation
            1. Horizontal navigation
            2. Vertical navigation
            3. Jump navigation
          3. Content elements
            1. Collection views
              1. UITableView (iOS)
              2. UICollectionView (iOS)
              3. ListView (Android)
              4. GridView (Android)
              5. CardView (Android)
              6. ListView and ListBox (Windows Phone)
              7. GridView (Windows Phone)
              8. Virtualizing panels (Windows Phone)
            2. Modal views
              1. Popover and alerts (iOS)
              2. Flyout, popups, and menus (Windows Phone)
              3. Dialogs (Android)
            3. Text views
            4. Web views
          4. Feedback
            1. Indeterminate progress
            2. Determinate progress
        3. User interaction
          1. Interactive controls
            1. Text input
            2. Dropdown selection
            3. Option selection
          2. Gestures
        4. Summary
      15. 8. Xamarin.Forms
        1. Under the hood
          1. Anatomy of Xamarin.Forms
          2. Project structure
        2. Components
          1. Pages
            1. Tabbed page
            2. The MasterDetail page
            3. NavigationPage
            4. CarouselPage
            5. ContentPage
          2. Layouts
          3. Views
        3. Extending forms
          1. Styles
          2. Triggers and behaviors
          3. Custom renderers
        4. Patterns and best practices
          1. Messaging infrastructure
          2. Dependency injection
          3. Shared project versus portable project
          4. Platform-specific fine-tuning
        5. Summary
      16. 9. Reusable UI Patterns
        1. Visual assets
          1. Text resources
            1. Xamarin.Android
            2. Xamarin.iOS
            3. Windows Phone
          2. Image resources
          3. Adaptive visual assets
          4. Reusable assets
        2. Localization
          1. Locale and culture
          2. Windows Phone
          3. Xamarin.iOS
          4. Xamarin.Android
          5. Xamarin.Forms
        3. Architectural patterns
          1. MVC
            1. iOS app architecture
          2. MVVM
            1. Windows Runtime
            2. MVVM on Xamarin.iOS and Xamarin.Android
            3. MVVM with Xamarin.Forms
        4. Summary
      17. 10. ALM – Developers and QA
        1. Development pipeline
        2. Troubleshooting and diagnostics
        3. Unit testing
          1. Platform-agnostic unit tests
          2. Platform-specific unit tests
        4. UI testing
          1. Xamarin.UITests and Xamarin Test Cloud
          2. Xamarin Test Recorder
          3. Coded UI tests (Windows Phone)
          4. Calabash
        5. Summary
      18. 11. ALM – Project and Release Management
        1. Source control
          1. TFVC
          2. Git
          3. TFS/Git scenarios
            1. Git bridge
            2. NuGet packages
          4. Subversion (SVN)
        2. Continuous integration
          1. Visual Studio Team Services
          2. TeamCity
          3. Other
        3. Automated testing
        4. Beta deployment
          1. HockeyApp
          2. Crashlytics
          3. TestFlight
          4. Package distribution
        5. Live telemetry
          1. Xamarin Insights
          2. Application Insights
        6. Summary
      19. 12. ALM – App Stores and Publishing
        1. Release packages
          1. Xamarin.Android app package (.apk)
            1. Disabling debugging
            2. Linking
            3. Packing options
            4. Packaging
          2. Xamarin.iOS app bundle (.ipa)
            1. Build options
            2. Linking
            3. Provisioning profile
          3. Windows Phone app package (.appx)
        2. Distribution options
          1. App store(s)
          2. Ad-hoc
        3. Line of Business apps
          1. Private channel distribution (Android)
          2. Apple Developer Enterprise Program
          3. Windows Phone private distribution
        4. Summary
      20. Index