Mobile Development in .NET mit

1 Mobile Web (Hybrid) Apps

Vorteil: • Weniger Aufwand • Multi-Plattform • Web-Technologien

Nachteil: UX • Performance • UI Design • Gerätefunktionen

2 Plattform abstrahieren

3 Entwicklung pro Plattform

4 Xamarin Ansatz

5 Native Mobile Apps mit Xamarin 1. Bestehendes .NET Know-How

2. Mächtige Plattform und Tools (Linq, Xml, Events/Delegates, Parallel Programming, Visual Studio/TFS, …)

3. Shared Code zwischen Plattformen

6 Benötigtes Know-How

.NET

7 Xamarin.iOS C#

8 Xamarin.Android C#

twitterListView.setOnItemClickListener (new OnItemClickListener () { public void onItemClick (AdapterView parent, View view, int position, long id) { Intent tweetDetails = new Intent (TwitterScreen.this, TweetDetailsScreen.class); tweetDetails.putExtra ("TweetID", TwitterFeed[position].ID); startActivity (tweetDetails); } };

twitterListView.ItemClick += (s, e) => { var tweetDetails = new Intent (this, typeof (TweetDetailsScreen)); tweetDetails.PutExtra ("TweetID", TwitterFeed[e.Position].ID); StartActivity (tweetDetails); };

9 Entwicklungsumgebung

OS Mac OSX Windows UI Designer Android, iOS Build Android, iOS Debug Android (Device und ARM/x86 Emulator) iOS (Device und Emulator auf Mac)

10 Kompilierung und Ausführung

AOT ARM Binary ARM iOS App Xamarin.iOS Mono CLR für iOS Binary (C#,F#) Profil Assembly (Monotouch) iOS APP iOS APP iOS/Cocoa Touch Shared Code Multi-Platform (C#,F#,VB.NET) Profil Assembly

IL+JIT Android.* Java.* Mono CLR für Android App Xamarin.Android Android APK (C#,F#) Profil Assembly Android (Monodroid) Android APK Dalvik Solution mit IL Code für plattform- Projekten spezifische Profile Android/Linux Kernel

11 Architektur

iOS App View Controllers Storyboards/Segues Portable Class Library Table Views ViewModel Foundation/UIKit Business Logic Entities Repository/DAL Android App CloudServiceAccess Activities Intents ListViews, Adapters Android SDK

12 DEMO

13 Architektur

iOS App View Controllers iOS Class Library Storyboards/Segues IPlatformDependent Portable Class Library Implementation Table Views ViewModel Foundation/UIKit Business Logic Entities Repository/DAL Android App CloudServiceAccess Activities Android Class Library Intents IPlatformDependent IPlatformDependent ListViews, Adapters Implementation NuGet Package Android SDK Pure/Advanced PCL

14 Portierbarer Code (Anteil in %)

72% 86% 46% 53%

61% 70% 44% 53%

15 Portabilität erhöhen

Portable Class Libraries für Xamarin • HTTPClient • Json.Net • MvvMCross • RestSharp • CouchBase • MailKit/MimeKit • …

16 Portabilität erhöhen Xamarin Components/Plugins • Battery Status • Compass • Barcode Scanner • Device Info • File System • Notifications • Messaging • Push Notifications • Text To Speech • Contacts • Leds • Band • … https://github.com/xamarin/XamarinComponents

17 Xamarin.Forms Eine UI Definition für alle 3 Plattformen in XAML (DataBinding) Verwendet native UI Controls Mischung möglich

18 DEMO

19 ALM Tool Chain und TFS Integration • VCS nach Wahl • Xamarin Studio hat keinen TFS- VCS Support • Builds • TFS 2015 Buildsystem • MacOS/Windows Agents • Tasks zum Builden • Issues/Board • Keine Änderung

20 Debugging Voller Funktionsumfang: Breakpoints, Watches, Callstack, …

Unterstützung für: Android (Hardware & Emulator) iOS (Hardware & Emulator über Build Host)

21 Testing • Manuelles Testen • Unit Tests möglich

• Xamarin Test Cloud • ~2000 verschiedene Geräte zum Testen • Nicht in Lizenz enthalten

22 Zusätzliche Tools von Xamarin • Xamarin Android Player • Remote iOS Simulator • Xamarin.Forms Previewer (alpha) • Workbooks

23 Xamarin Lizenzierung und Kosten Lizenzierung  bei Visual Studio Lizenz dabei  auch bei Community Edition

Mac Hardware für Xamarin.iOS benötigt

24 Xamarin Nachteile  Stabilität  Mehraufwand bei der Architektur, damit der Code portable bleibt

25 Fazit Mobile Apps dringen in alle Bereiche vor  Android und iOS als dominante Plattformen

Schneller Einstieg für .NET/C# Entwickler  Einarbeitung in Android/iOS SDK erforderlich

Mächtige Werkzeuge und Plattformen (.NET/VS)  X-Plattform Code Sharing (50-80%)  Hohe Popularität in der .NET Community (Libraries!)

26 Popularität

27 Fragen?

28