0%

Book Description

Learn how to efficiently develop Android and iOS apps for deployment using the Xamarin platform

In Detail

Xamarin is a Mono-based suite of products that allows developers to create iOS and Android apps using C# and .NET.

This learning guide is your first port of call to quickly learn Xamarin. Starting with the foundations by understanding the architecture behind Xamarin.iOS and Xamarin.Android, you will be guided through creating your first Xamarin.iOS and Xamarin.Android applications. In addition, you will learn how to utilize frameworks such as MvvmCross and Xamarin.Forms to increase the amount of code reuse. To conclude your journey, you will be shown how to develop your own Xamarin apps for distribution.

Xamarin Essentials is the guide to use in order to quickly gain practical working knowledge of developing robust commercial mobile apps using C# and sharing large portions of your code base across iOS and Android apps.

What You Will Learn

  • Familiarize yourself with the set of Mono-based commercial products offered by the Xamarin platform
  • Get to grips with the architecture behind Xamarin.iOS and Xamarin.Android
  • Develop Xamarin apps using Xamarin Studio and/or Visual Studio
  • Create a user interface using Xamarin.iOS Designer
  • Build, run, and debug iOS and Android apps
  • Increase code reuse using frameworks such as MvvmCross and Xamarin.Forms
  • Prepare iOS and Android apps for distribution

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 files e-mailed directly to you.

Table of Contents

  1. Xamarin Essentials
    1. Table of Contents
    2. Xamarin Essentials
    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. Xamarin and Mono – a Pathway to the Unnatural
      1. Understanding Mono
      2. The Xamarin product suite
      3. Evaluating whether Xamarin is the right tool
      4. Learning C#
      5. Installing Xamarin
        1. Installing Xamarin on OS X
        2. Installing Xamarin on Windows
      6. Development environments
        1. Using the Xamarin Studio environment
        2. Using Xamarin Studio to develop Android apps
        3. Using Xamarin Studio to develop iOS apps
        4. Using the Visual Studio environment
          1. Using Visual Studio to develop Android apps
          2. Using Visual Studio to develop iOS apps
        5. Comparing IDEs
        6. Version control
      7. Summary
    9. 2. Demystifying Xamarin.iOS
      1. Xamarin.iOS and Ahead-of-Time compilation
      2. Understanding Mono assemblies
      3. Xamarin.iOS bindings
        1. The design principles
        2. C# types and type safety
        3. Use of inheritance
        4. Mapping Objective-C delegates
          1. Via .NET events
          2. Via .NET properties
          3. Via strongly typed delegates
          4. Via weakly typed delegates
      4. Creating binding libraries
      5. Memory management
        1. Disposing of objects
        2. Keeping objects around
      6. Limitations of using the AOT compilation
        1. Runtime features disabled
      7. Generating code for XIB and storyboard files
        1. Generated classes
          1. Designer files
          2. Non-designer files
          3. Outlets properties
          4. Action properties
      8. Xamarin.iOS Designer
      9. Summary
    10. 3. Demystifying Xamarin.Android
      1. Mono CLR and Dalvik VM – working side by side
        1. Introducing the Java Native Interface
        2. Peer objects
      2. Xamarin.Android application packaging
      3. Understanding Mono assemblies
      4. Xamarin.Android bindings
        1. The design principles
        2. Properties
        3. Events versus listeners
        4. Special help with collections
        5. Interfaces
        6. Mapping nested classes
        7. Mapping the Runnable interface
        8. Enumerations
        9. Resources
      5. Attributes for the ApplicationManifest.xml file
      6. Editor for the ApplicationManifest.xml file
      7. Garbage collection
        1. JNI global and weak references
        2. Mono collections
        3. Automatic collections
        4. Helping the GC
      8. Xamarin.Android Designer
      9. Summary
    11. 4. Developing Your First iOS App with Xamarin.iOS
      1. The sample national parks app
      2. Creating the sample app
        1. The Project Options view
      3. Running and debugging within Xamarin Studio
      4. Extending the sample app
        1. Storing and loading national parks
          1. Adding Json.NET
          2. Creating an entity class
        2. Adding a JSON-formatted file
          1. Loading objects from a JSON-formatted file
          2. Saving objects to a JSON-formatted file
          3. Running the app
        3. Enhancing the UI
          1. Touring the Xamarin.iOS Designer
          2. Adding EditViewController and segues
          3. Implementing the DoneClicked event handler
          4. Implementing the DeleteClicked action
          5. Passing data
          6. Running the app
      5. Finishing the sample app
        1. Finishing DetailViewController
        2. Finishing EditViewController
        3. Running the app
      6. MonoTouch.Dialog
      7. Summary
    12. 5. Developing Your First Android App with Xamarin.Android
      1. The sample app
      2. Creating NationalParks.Droid
      3. Reviewing the app
        1. Resources
        2. The Resource.designer.cs file
        3. The MainActivity.cs file
        4. The Main.axml file
        5. Project Options
        6. Xamarin Studio Preferences
      4. Running and debugging with Xamarin Studio
        1. Running apps with the Android Emulator
        2. Running apps on a physical device
        3. Running apps with Genymotion
      5. Extending NationalParks.Droid
        1. Storing and loading national parks
          1. Adding Json.NET
          2. Borrowing the entity class and JSON file
          3. Creating the NationalParksData singleton
        2. Enhancing MainActivity
          1. Adding a ListView instance
            1. Touring the Xamarin.Android Designer
            2. Editing the Main.xml file
          2. Creating an adapter
          3. Adding the New action to the ActionBar
            1. Overriding the OnCreateOptionsMenu() method
            2. Overriding the OnOptionsItemSelected() method
          4. Running the app
        3. Creating the DetailActivity view
          1. Adding ActionBar items
          2. Populating DetailActivity
          3. Handling the Show Photos action
          4. Handling the Show Directions action
          5. Adding navigation
          6. Running the app
        4. Creating EditActivity
          1. Adding ActionBar items
          2. Creating reference variables for widgets
          3. Populating EditActivity
          4. Handling the Save action
          5. Handling the Delete action
          6. Adding navigation
            1. Navigating on the New action
            2. Navigating on the Edit action
          7. Refreshing ListView in MainActivity
          8. Running the app
      6. Working with Xamarin.Android projects in Visual Studio
      7. Reviewing the generated elements
        1. Peer objects
        2. The AndroidManifest.xml file
        3. The APK file
      8. Summary
    13. 6. The Sharing Game
      1. Sharing and reuse
      2. Old school source file linking
        1. Creating a shared library project
        2. Updating NationalParks.Droid to use shared files
        3. Updating NationalParks.iOS to use shared files
      3. Portable Class Libraries
        1. Creating NationalParks.PortableData
        2. Implementing IFileHandler
        3. Updating NationalParks.Droid to use PCL
        4. Updating NationalParks.iOS to use PCL
      4. The pros and cons of the code-sharing techniques
      5. Summary
    14. 7. Sharing with MvvmCross
      1. Introducing MvvmCross
        1. The MVVM pattern
        2. Views
        3. ViewModels
        4. Commands
        5. Data binding
          1. The binding modes
          2. The INotifyPropertyChanged interface
          3. Binding specifications
        6. Navigating between ViewModels
          1. Passing parameters
          2. Solution/project organization
          3. The startup process
            1. App.cs
            2. Setup.cs
            3. The Android startup
            4. The iOS startup
      2. Creating NationalParks.MvvmCross
        1. Creating the MvvmCross core project
        2. Creating the MvvmCross Android app
          1. Reusing NationalParks.PortableData and NationalParks.IO
            1. Implementing the INotifyPropertyChanged interface
          2. Implementing the Android user interface
          3. Implementing the master list view
            1. Creating MasterViewModel
            2. Updating the Master.axml layout
            3. Creating the MasterView activity
          4. Implementing the detail view
            1. Creating DetailViewModel
            2. Updating the Detail.axml layout
            3. Creating the DetailView activity
            4. Adding navigation
          5. Implementing the edit view
            1. Creating EditViewModel
            2. Updating the Edit.axml layout
            3. Creating the EditView activity
            4. Adding navigation
        3. Creating the MvvmCross iOS app
          1. Implementing the iOS user interface
          2. Implementing the master view
          3. Implementing the detail view
            1. Adding navigation
          4. Implementing the edit view
            1. Adding navigation
            2. Refreshing the master view list
      3. Considering the pros and cons
      4. Summary
    15. 8. Sharing with Xamarin.Forms
      1. An insight into the Xamarin.Forms framework
        1. Pages
        2. Views
        3. Layouts
        4. Cells
        5. Navigation
        6. Defining Xamarin.Forms user interfaces
          1. Extensible Application Markup Language (XAML)
          2. Code-behind classes
        7. Data binding
        8. Using Renderers
        9. Native features and the DependencyService API
        10. App startup
          1. Shared App classes
          2. iOS apps
          3. Android apps
        11. Project organization
      2. Creating the NationalParks Xamarin.Forms app
        1. Creating the solution
          1. Adding NationalParks.PortableData
        2. Implementing ParksListPage
        3. Implementing ParkDetailPage
          1. Using DependencyService to show directions and photos
            1. Creating the interface
            2. Creating the iOS implementation
            3. Creating the Android implementation
            4. Adding calls to DependencyService
            5. Running the app
        4. Implementing ParkEditPage
      3. Considering the pros and cons
      4. Summary
    16. 9. Preparing Xamarin.iOS Apps for Distribution
      1. Preparing for distribution
        1. Profiling Xamarin.iOS apps
        2. iOS Application (Info.plist) settings
        3. iOS Build settings
          1. SDK Options
          2. Linker Options
            1. Overriding the linker
          3. Debugging options
          4. Code generation options
            1. Supported architectures
            2. LLVM optimizing compiler
            3. ARM thumb instruction set
      2. Distributing Xamarin.iOS apps
        1. The Ad Hoc and enterprise distributions
          1. TestFlight distribution
        2. App Store submission
      3. Summary
    17. 10. Preparing Xamarin.Android Apps for Distribution
      1. Preparing for a release APK
        1. Profiling Xamarin.Android apps
        2. Disabling debug
          1. Changing the settings in AndroidManifest.xml
          2. Changing the settings in AssemblyInfo.cs
        3. Android Application (AndroidManifest.xml) settings
        4. Linker Options
          1. Overriding the linker
            1. Preserving code with attributes
            2. Preserving code with custom linker files
            3. Skipping assemblies
        5. Supported ABIs
      2. Publishing a release APK
        1. Keystores
        2. Publishing from Xamarin.Android
        3. Republishing from Xamarin.Android
        4. Publishing from Visual Studio
      3. App distribution options
      4. Summary
    18. Index
18.222.184.162