Developing Cross-Platform
Native Apps with Xamarin
for Boston Tech Workshops
by Dan HermesXamarin MVP, Software ConsultantLexicon Systems
[email protected]@danhermes
About Me
Dan HermesPresident of Lexicon SystemsMobile and .NET software consultantAuthor, speaker
My Xamarin Book
Now Available on Amazon
“This weighty book gives clear guidance that will help you build quality apps, starting with architectural considerations, and then jumping into practical code strategies.” - Bryan Costanich, Vice President, Xamarin
“Dan Hermes’ extraordinary book is the most intelligent work on cross-platform mobile development I’ve seen.” – Jesse Liberty, Director of New Technology Development, Falafel Software, Xamarin Certified Developer / Xamarin MVP
Why are we building mobile apps for business?
Explosive Mobile v. PC GrowthQuarterly unit shipments (m)
300
250
200
150
100
50
0
PCs iOS & Android
March-95 March-97 March-99 March-01 March-03 March-05 March-07 March-09 March-11 March-13
Source: “Mobile is Eating the World” (Benedict Evans)
How do we buildmobile apps for business?
Mobile App Types
• Mobile Web /Responsive• Browser-based
• Native• iOS, Android, OR Windows
• Hybrid• Web app wrapped in a native app
• Cross-platform• iOS, Android, AND Windows
Native vs. Hybrid
Native User Interface and Native User Experience vs. Hybrid
People Expect Great Experiences
Which platforms do we build for?
Smartphone OS Market Share
• Android – 66%• iOS – 28%• Windows Phone – 3%
What does this mean?
Single platform apps are risky
Cross-platform Apps
• Develop using a single technology (ex. C#, HTML5)• Can run on all platforms
• iOS• Android• Windows Phone
What Are the Benefits of Cross-platform Apps?
• Shared Code• Code reuse
• One technology stack• Instead of several
• Native app quality• Native app performance• Native phone functionality (location, camera, etc.)
Biggest Challenges of Multi-platform Development
Code Divergence Development Complexity Team Divergence Process Complexity
Schedule Cost=
Cross-Platform Solutions
Xamarin Code in C# then compile to respective native platforms
Titanium, NativeScript & React Native Native shell around a JavaScript core app with some UI compiled to native
Cordova Device-resident web app that can be wrapped in a native shell
Xamarin’s Approach
Native UI
C# + XAML
Fully native apps written entirely in C#
Shared App Logic in C#
Xamarin delivers fully native user interfaces and app functionality
Complete access to 100% of the native APIs for iOS, Android and Windows in C#
Share app logic and UI code across device platforms
Xamarin Studio
Optimized for cross-platform mobile development
Explore native APIs with code completion
World class Android and iOS designers
Powerful debugging on simulator or device
Xamarin Plug-in for Visual Studio
Native Performance
Xamarin.iOS does full Ahead Of Time (AOT) compilation to produce an ARM binary for Apple’s App Store.
Xamarin.Android takes advantage of Just In Time (JIT) compilation on the Android device.
Mobile Visionary in Gartner Magic Quadrant
“Xamarin's architectural approach provides completely native UIs with better performance than other cross-platform techniques… Xamarin uses multifaceted technology built by a cohesive team with a solid long-term track record.”
Mobile Visionary in Magic Quadrant
Xamarin’s Enterprise Partnerships
The experiences your users expect.The security and connections your organization requires.
Benefits of Cross-Platform Development • Combine code and development teams
• Shared codebase• Same programming skillset
• Run on multiple platforms• iOS• Android• Windows Phone
Xamarin’s Default App Architecture
Native UI
C# + XAML
Shared app logic, platform-specific UI, all in C#
Shared App Logic in C#
iOS C# UI Android C# UI Windows C# UI
Shared App Logic
Platform-specific UI code in C#
Shared app logic code in C#
Fine-grain control over the app user interface
Good for apps with sophisticated UX requirements (complicated gestures, animations, design)
Xamarin.Forms
• Cross-platform user interface for Xamarin• Announced in May of 2014• Growing set of cross-platform controls• Each control will be mapped to its native equivalent at runtime
Xamarin.Forms UI
Xamarin.Forms features first developed for C# (code-first)
XAML implementation then provided, so…
Anything you can do in C#, I can do in XAML
What is XAML?
C# or XAML for UI Development
The Xamarin.Forms App Architecture
Shared App Logic
Xamarin.Forms
Increase Code Sharing Up to 100% and Deliver a Fully Native App
Shared UI code in C#
Shared app logic code in C#
Mix-and-Match the use of Xamarin.Forms with platform-specific code.
Good for forms-based, apps with a lot of data entry screens
Easy to learn API makes you productive immediately, without platform-specific knowledge
Xamarin App Architectures
iOS C# UI Android C# UI Windows C# UI
Shared App Logic Shared App Logic
Xamarin.Forms
Platform-specific Xamarin.Forms
Page, Layout, View
Pages
Layouts
When to Use Xamarin.Forms?
• Learning Xamarin• Cross-platform scaffolding• Basic business apps• Basic design• Simple cross-platform screens• Device-unique controls are not needed• Complex graphics processing is not needed
Microsoft acquired Xamarin
Miguel de Icaza, Xamarin CTO
Automatically test your app on hundreds of real devices in the cloud
Xamarin Test Cloud – Testing Made Easy
What do I do all day?
• Develop web and mobile apps
• Xamarin experts• Founded in 1999• Microsoft technology stack
We advise on and build apps for business.
What We Do
a continuum of services from advisement to hands-on
Our Clients Include
and many small and medium-sized companies.
Our Proficiencies
•Web applications• Microsoft Technologies• C#, .NET, ASP.NET, MVC, HTML5,
Javascript
•Mobile apps• iOS, Android, Windows Phone• Built using Xamarin
MOBILE APPS IN THE WILD
(Case Studies)
Certification training and professional platform for orthopedic surgeons
•50,000 orthopedic surgeon user base•Surgical topics, case studies, images•Sample tests and test questions•Surgeons can vote, comment, and cite journal entries
Cross-platform
iOS Android
Feature-rich and Intuitive UI
Biotech market leader
•DNA and breast cancer research •Engage lab techs more deeply through their ThermoFisher equipment•Bring real-time data directly from DNA-processing laboratory equipment into the hands of scientists
Xammy Finalist
Thermo Cycler orPCR Device (polymerase chain reaction)for DNA Duplication
PCR Essentials
Internet of Things (IoT)Real-time Integration with Lab Devices
Federal Aviation Administration (FAA)
• Recreational drone use presents risks and threats
• FAA announcing new regulations
• Help drone flyers fly safely
B4UFLY
• Plan your trips• Airport locations• Controlled Airspace• Special Airspace• Flight Warnings• No-fly Zones
Xamarin gives us cross-platform reach
with native power and performance
Web and Mobile Work Together
• Modern biz apps combine web and mobile technology• They share data sources, look and feel, and support one another• A Unified technology foundation simplifies this• Mobile and web apps all built with C# provides this foundation
• Xamarin• .NET• ASP.NET MVC• Angular and other JavaScript options
Need Something Xamarin-flavored?
• I do Xamarin consultations• I do Xamarin coaching and training• My firm does Xamarin development• We help make Xamarin projects work
Developing Cross-Platform Native Apps with
XamarinDan Hermes
developer, author, consultant, founder of Lexicon Systems
Available on Amazon
My blog: www.mobilecsharpcafe.com
Twitter: @danhermes