30
Intro to Building Mobile Apps with Xamarin HEATHER DOWNING

Intro to Building Mobile Apps with Xamarin

Embed Size (px)

Citation preview

Page 1: Intro to Building Mobile Apps with Xamarin

Intro to Building Mobile Apps with XamarinHEATHER DOWNING

Page 2: Intro to Building Mobile Apps with Xamarin

Heather Downing

-Technical focus in .Net, mobile and JS -Experience working with Fortune 500 companies -Speaker and entrepreneur -Horseback Archery Competitor -Tolkien Enthusiast -Avid Star Trek Fan

@quorralyne

DigitalLightCycle.Blogspot.com

[email protected]

Page 3: Intro to Building Mobile Apps with Xamarin

Overview

Xamarin Framework Introduction1. Cross platform native compiled definition2. Hardware required3. Development environments4. Shared code options 5. Xamarin Forms library6. Architectural approach 7. Install prerequisites8. Emulators and debugging tools

Working With Xamarin Using Xamarin Studio Using Nuget Xamarin Components PCL approach Shared library approach Xamarin Forms approach Troubleshooting Additional Resources

Page 4: Intro to Building Mobile Apps with Xamarin

Xamarin Framework Introduction

Session Overview

Page 5: Intro to Building Mobile Apps with Xamarin

Xamarin is unique in this space by offering a single language – C#, class library, and runtime that works across all three mobile platforms of iOS, Android, and Windows Phone....while still compiling native (non-interpreted) applications that are performant enough even for demanding games.

HTTP://DEVELOPER.XAMARIN.COM

Page 6: Intro to Building Mobile Apps with Xamarin

1. Cross platform native compiled definition

Page 7: Intro to Building Mobile Apps with Xamarin

Xamarin Architectural Flow

Page 8: Intro to Building Mobile Apps with Xamarin

2. Hardware Required

Page 9: Intro to Building Mobile Apps with Xamarin

NOTE:• To develop for iOS on Windows computers there must be a

Mac computer accessible on the network, for remote compilation and debugging. This also works if you have Visual Studio running inside a Windows VM on a Mac computer.

Page 10: Intro to Building Mobile Apps with Xamarin

IOS Build Host / Xamarin Mac Agent

Xamarin.iOS for Visual Studio accomplishes an amazing feat: it lets you create, build, and debug iOS applications on a Windows computer using the Visual Studio IDE.

In order to run the iOS emulator or install on an Apple device, an .ipa file must be created.

An .ipa file is an iOS application archive file which stores an iOS app. Each .ipa file includes a binary for the ARM architecture and can only be installed on an iOS-device.

Page 11: Intro to Building Mobile Apps with Xamarin

3. Development Environments

Page 12: Intro to Building Mobile Apps with Xamarin

Xamarin Studio

Xamarin Studio is a modern, sophisticated IDE with many features for creating iOS, Mac and Android applications. It includes a rich editor, debugging, native platform integration with iOS, Mac and Android, and integrated source control to name just of few of its many features.

-Available to all subscription levels-Can be used on a Mac or a PC

Page 13: Intro to Building Mobile Apps with Xamarin

Visual Studio + Xamarin Plugin

Developers familiar with Visual Studio can leverage existing skills and increase productivity by developing for Xamarin with Visual Studio. Visual Studio support also means that applications sharing code between iOS, Android, and Windows can be developed in the same IDE.

-Available to Business subscription level and above-Can be used ONLY on PC

Page 14: Intro to Building Mobile Apps with Xamarin

4. Shared Code Options

Page 15: Intro to Building Mobile Apps with Xamarin

Portable Class Library (PCL)

Portable Class Libraries allow you to write code and produce libraries that can be shared across multiple platforms including Xamarin.iOS, Xamarin.Android and Windows Phone. Portable Class Libraries (PCLs) can be created in both Xamarin Studio and Visual Studio, and then referenced in each platform-specific project to allow code to be easily shared.

Page 16: Intro to Building Mobile Apps with Xamarin

BENEFITS • Allows you to share code across multiple projects. • Refactoring operations always update all affected references.

DISADVANTAGES • Cannot use compiler directives. • Only a subset of the .NET framework is available to use, determined by the profile selected.

Page 17: Intro to Building Mobile Apps with Xamarin

Shared Project

Benefits• Allows you to share code across multiple projects.• Shared code can be branched based on the platform using compiler directives

(eg. using #if __ANDROID__).• Application projects can include platform-specific references that the shared code can utilize.

Disadvantages• Unlike most other project types, a Shared Project has no 'output' assembly. During compilation, the files are

treated as part of the referencing project and compiled into that DLL. If you wish to share your code as a DLL then Portable Class Libraries are a better solution.

• Refactorings that affect code inside 'inactive' compiler directives will not update the code.

Page 18: Intro to Building Mobile Apps with Xamarin
Page 19: Intro to Building Mobile Apps with Xamarin

5. Xamarin Forms Library

Page 20: Intro to Building Mobile Apps with Xamarin

6. Architectural Approach

Page 21: Intro to Building Mobile Apps with Xamarin

7. Install Prerequisites

Page 22: Intro to Building Mobile Apps with Xamarin

Update Android SDK

Run the Android SDK Manager as an Administrator Install at least the latest three Android SDK Build tools Install ALL the files listed under the latest API version (6.0) Run Xamarin Studio as an Administrator Set the target framework to be the latest version

Page 23: Intro to Building Mobile Apps with Xamarin

8. Emulators and Debugging Tools

Page 24: Intro to Building Mobile Apps with Xamarin

Install Xamarin Android Player

The Xamarin Android Player relies on virtualization and OpenGL. This means that it cannot run inside virtual machine instances nor can it work over Remote Desktop or VNC.

For OSX, Windows 7, Windows 8, and Windows 8.1, the Xamarin Android Player requires VirtualBox 4.3.18 or higher, which will be installed or updated as necessary. For Windows 10, you must upgrade VirtualBox to version 5.0.2 or higher.

https://developer.xamarin.com/guides/android/getting_started/installation/android-player/

Page 25: Intro to Building Mobile Apps with Xamarin

Install Emulator API versionsBring down several sizes of each version of Android for better testing of what your application looks like

Page 26: Intro to Building Mobile Apps with Xamarin

BREAK

Intro to Building Mobile Apps with Xamarin

Page 27: Intro to Building Mobile Apps with Xamarin

Working with Xamarin

Live Coding Session

Page 28: Intro to Building Mobile Apps with Xamarin

Using Xamarin Studio

Page 29: Intro to Building Mobile Apps with Xamarin

Additional Resources

Xamarin Overview: https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/part_1_-_understanding_the_xamarin_mobile_platform/System Requirements: https://developer.xamarin.com/guides/cross-platform/getting_started/requirements/Xamarin PCL vs Shared Project Article: http://hotkrossbits.com/2015/05/03/xamarin-forms-pcl-vs-shared-project/Xamarin Code Sharing Options: https://docs.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/Using Xamarin Forms: https://developer.xamarin.com/guides/xamarin-forms/web-services/consuming/rest/Xamarin Forms Dependencies for Android: http://screencast.com/t/U5FBj6KlHXamarin Android Player Installation: https://developer.xamarin.com/guides/android/getting_started/installation/android-player/