You are previewing Xamarin Blueprints.
O'Reilly logo
Xamarin Blueprints

Book Description

Leverage the power of Xamarin to create stunning cross-platform and native apps

About This Book

  • Helps you get a clear practical understanding of creating professional-grade apps with Xamarin

  • Covers Xamarin.Forms, Xamarin Android, and Xamarin iOS

  • If you want to transform yourself from an amateur mobile developer into a professional app developer across multiple platforms, then this is the ideal book for you

  • Who This Book Is For

    If you are a mobile developer looking to create interesting and fully featured apps for different platforms, then this book is the ideal solution for you. A basic knowledge of Xamarin and C# programming is assumed

    What You Will Learn

  • Discover eight different ways to create your own Xamarin applications

  • Improve app performance by using SQLite for data-intensive applications

  • Set up a simple web service to feed JSON data into mobile applications

  • Store files locally with Xamarin.Forms using dependency services

  • Use Xamarin extension libraries to create effective applications with less coding

  • In Detail

    Do you want to create powerful, efficient, and independent apps from scratch that will leverage the Xamarin framework and code with C#? Well, look no further; you’ve come to the right place!

    This is a learn-as-you-build practical guide to building eight full-fledged applications using Xamarin.Forms, Xamarin Android, and Xamarin iOS.

    Each chapter includes a project, takes you through the process of building applications (such as a gallery Application, a text-to-speech service app, a GPS locator app, and a stock market app), and will show you how to deploy the application’s source code to a Google Cloud Source Repository. Other practical projects include a chat and a media-editing app, as well as other examples fit to adorn any developer’s utility belt.

    In the course of building applications, this book will teach you how to design and prototype professional-grade applications implementing performance and security considerations.

    Style and approach

    A project-based approach that will solve all your needs when it comes to creating native Android, iOS, and cross-platform apps efficiently and effectively.

    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. Xamarin Blueprints
      1. Xamarin Blueprints
      2. Credits
      3. About the Author
      4. About the Reviewer
      5. www.PacktPub.com
        1. Why subscribe?
      6. 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
      7. 1. Building a Gallery Application
        1. Create an iOS project
        2. Creating a UIViewController and UITableView
        3. Customizing a cell's appearance
        4. Creating an Android project
        5. Creating an XML interface and ListView
        6. Shared projects
        7. Custom row appearance
        8. Bitmap functions
        9. The ALAssetLibrary
        10. Adding the iOS photo screen
        11. Adding the Android photo screen
        12. Summary
      8. 2. Building a SpeechTalk Application
        1. Cross-platform development with Xamarin.Forms
          1. So how would this look in Xamarin.Forms?
        2. Setting up platform projects
          1. So what is happening here?
        3. Setting up the SpeechTalk.iOS project
        4. Setting up the SpeechTalk.Droid project
        5. Xamarin.Forms, Windows Phone, and Visual Studio
          1. What can we see here?
        6. Inversion of Control (IoC) with Xamarin.Forms
          1. So why should we use it?
          2. So how do we benefit from this?
        7. Autofac
        8. iOS text-to-speech implementation
        9. Bindings
        10. Android text-to-speech implementation
        11. Setting up IoC with Android
        12. WinPhone text-to-speech implementation
        13. IoC with Windows Phone
        14. Platform independent styling
        15. Summary
      9. 3. Building a GPS Locator Application
        1. Core location and GPS
          1. Project setup
          2. Navigation with Xamarin.Forms
          3. Why would we do this?
          4. Building the navigation control
          5. View model navigation
          6. Integrating Google Maps using Xamarin.Forms.Maps
          7. Reactive Extensions
          8. Core location with iOS and the CLLocationManager library
        2. Handling location updates
          1. Android and the LocationManager
          2. Creating an exit point
          3. Creating an API key for Android
          4. Creating our Windows project
          5. Core Location Services with Windows Phone
          6. The Application class
          7. Web services and data contracts
          8. What about data contracts?
          9. Creating another API key for geocoding
          10. Creating GeocodingWebServiceController
          11. Newtonsoft.Json and Microsoft HTTP client libraries
          12. ModernHttpClient and client message handlers
          13. Feeding JSON data into the IObservable framework
          14. More Reactive Extensions
          15. Resource (RESX) files
          16. Using GeocodingWebServiceController
          17. OnNavigatedTo and OnShow
          18. Pythagoras equirectangular projection
          19. How are we going to calculate the closest position?
        3. Summary
      10. 4. Building an Audio Player Application
        1. Solution setup
        2. Inversion of control with MVVMCross
        3. View-models with Xamarin native
        4. Creating the bindings
        5. NSLayoutContraints
        6. MVVMCross setup inside the PCL
        7. Setting up MVVMCross with iOS
        8. Setting up MVVMCross with Android
        9. The SoundHandler interface
        10. Implementing the iOS SoundHandler using the AVAudioPlayer framework
        11. The Mvx IoC container
        12. The audio player
        13. A cleaner code approach to NSLayout
        14. Creating AudioPlayerPageViewModel
        15. Implementing the Android SoundHandler using the MediaPlayer framework
        16. XML and Mvx bindings
        17. MvxActivities
        18. Summary
      11. 5. Building a Stocklist Application
        1. Understanding the backend
        2. Creating an ASP.Net Web API 2 project
        3. Building an API controller
        4. Setting up the mobile projects
        5. Building core mobile projects
        6. Improving app performance
        7. Creating a global App.xaml
        8. Theming with ControlTemplates
        9. Updating the MainPageViewModel
        10. Creating the Stocklist web service controller
        11. ListViews and ObservableCollections
        12. Value converters
        13. Adding a DataTemplate to the global resource dictionary
        14. Styles
        15. Further optimization with XAML
        16. Creating StockItemDetailsPage
        17. Custom renderers
        18. Adding styles for custom elements
        19. Creating StockItemDetailsPageViewModel
        20. Setting up the native platform projects
        21. Hosting the Web API project locally
        22. Summary
      12. 6. Building a Chat Application
        1. The Model-View-Presenter (MVP) pattern
          1. So why bother with this approach?
        2. Architecture
          1. How do we determine which layers our project needs?
        3. SignalR
        4. Starting with Open Web Interface for .NET (OWIN)
          1. Creating an authorization server using OWIN OAuth 2.0
          2. OAuthAuthorizationServerProvider
          3. Use OAuthBearerAuthentication
        5. Setting up the AuthenticationRepository
          1. Configuring the Web API
          2. Building the AccountController
          3. Configuring OAuth Authentication with our Web API
          4. Building the SignalR Hub
        6. Setting up mobile projects
          1. Creating the SignalRClient
          2. Building the WebApiAccess layer
          3. Application state
        7. Setting up the navigation service
          1. Building the iOS navigation service
          2. Building the Android navigation service
          3. Building the iOS interface
        8. Handling Hub proxy callbacks
        9. Implementing the LoginPresenter
        10. Creating the connection between Presenter and View
        11. Building the LoginActivity
        12. Implementing the ClientsListPresenter
        13. Creating ClientListViewController
        14. The TaskCompletionSource framework
        15. Creating the ClientsListActivity
        16. Overriding the OnBackPressed activity
        17. Building the ListAdapter
        18. Building the ChatPresenter
        19. Building the iOS ChatView
        20. Extending the UIColor framework
        21. Android TableLayouts
        22. Building the Android ChatActivity
        23. Running the server and clients
        24. Summary
      13. 7. Building a File Storage Application
        1. Project structure setup
        2. Building a data access layer using SQLite
        3. Building the ISQLiteStorage interface
        4. Adding additional threading techniques
          1. How do we solve this problem?
        5. Creating the AsyncSemaphore
        6. Creating the AsyncLock
        7. Implementing native setup requirements for SQLite
        8. Implementing the IoC container and modules
        9. Implementing cross-platform logging
        10. Implementing the SQLiteStorage class
        11. Introduction to C# 6.0 syntax
        12. Handling alerts in view-models
        13. Building the IMethods interface
        14. Building the ExtendedContentPage
          1. Why are we implementing two different techniques for showing alerts?
        15. Building a CarouselView using custom layouts
        16. Adding scroll control to the CarouselView
        17. Building a CustomRenderer for native gestures
        18. Building the user interface
        19. Using a SynchronizationContext
          1. How do we know this context is from the main UI thread?
        20. Building the EditFilePage
        21. Behaviours
        22. Challenge
        23. Building the Windows Phone version
        24. Summary
      14. 8. Building a Camera Application
        1. Solution setup
        2. Building the MainPageViewModel class
        3. Improving the INotifiedPropertyChanged implementation
        4. Creating the custom UI objects
        5. Building the FocusView
        6. Xamarin.Forms animations
        7. Xamarin.Forms compound animations
        8. Building the CameraView
        9. Building a control for the iOS camera
        10. Building the iOS CameraRenderer
        11. Integrating the Android Camera2 framework
        12. Building the CameraViewRenderer in Android
        13. Handling native touch events through the FocusView
        14. Using RX to handle events
        15. Building a VisualElementRenderer for iOS
        16. Building the CustomImageRenderers
        17. Building the UIImageEffects class
        18. Building the CustomImageRenderer for Android
        19. Triggers
          1. Easing.SinIn
          2. Easing.SinOut
        20. Platform effects
        21. Building the CameraPage
        22. Adding native orientation events
        23. Challenge
        24. Summary