SlideShare a Scribd company logo
1 of 24
Dominik Minta 
dominik@minta.it 
Poznań Android Developer Group Meetup #3
Problem – typical application 
 Multiplatform – Android, iOS, Windows Phone 
 Tasks: 
- downloading, parsing and storing data (JSON, XML, 
images) from webservices in local database (SQL) 
- filtering and presenting data to user in a convenient 
form (lists, maps) 
- sharing content with social network (Facebook, 
Twitter etc.) 
- utilizing location services 
- taking a picture with camera 
 Some features are available offline
Typical solutions 
Native applications 
 Full access to platform capabilities 
(camera, GPS, accelerometer etc.) 
 Native UI 
 High performance (native code, 
hardware access) 
 Separate UI design and source code 
for each platform 
 Different libraries for the same task 
(downloading and displaying 
images, social network integration, 
handling network protocols etc.) 
 Developers must be familiar with 
each supported platform 
Hybrid applications 
 Many frameworks to choose from 
(Cordova/PhoneGap, ionic, 
Titanium, Sencha Touch…) 
 Single code base 
 Low entry level (HTML, CSS, JS) 
 Can be extended using native code 
 Partial access to platform 
capabilities out-of-the-box 
 HTML5 UI 
 Poor performance and 
responsiveness for extensive UI 
 Problems with webview on different 
platforms 
 JS debugging = pain
Xamarin Mobile Platform 
 Shared code on each platform (also UI!) 
 Full native API access 
 Native performance 
 Modern programming language – C# (F# also supported) 
 Multiplatform libraries 
 Works with existing libraries 
 Xamarin Studio multiplatformIDE (Linux, MacOS X, 
Windows) 
 Visual Studio plugin 
 Good documentation, community and support 
 http://xamarin.com
Applications built with Xamarin 
 Bastion 
 Calca 
 Draw a Stickman: EPIC 
 iCircuit 
 Infinite Flight 
 Legimi 
 Nokia MixRadio 
 Rdio 
 TouchDraw 
 Vezma 
Sources: 
http://www.monogame.net/showcase/ 
http://icircuitapp.com/ 
http://elevenworks.com/
 „Spotify for ebooks” 
 Ebook readers for Android, iOS, Windows Phone 7+, 
Windows 8 and Onyx e-ink devices 
 First app was running on Linux-based e-ink device using 
Mono runtime (2009) 
 Shared part of logic code (webservice 
communication, epub handling, 
DRM, local database, utility classes) 
 Native UI 
Source: legimi.com
How Xamarin works on Android? 
 Applications and libraries are compiled to .NET bytecode 
(Intermediate Language) which is stored in .NET 
assemblies (DLL) 
 Unused code is removed 
 Generated application package (APK) is shipped with 
Mono Virtual Machine (native library for each supported 
platform – ARM, x86) 
 When user runs an application, Mono JIT (Just-in-Time) 
compiler compiles IL to native code and executes it 
 Mono runtime handles memory allocation, garbage 
collection and serves as a bridge between user code and 
native API
Why you should learn C#? 
 var keyword 
 Properties 
 Events 
 Operator overloading 
 Indexers 
 Partial classes 
 „True” generics 
 Value types 
 Object/collection initializers 
 Extension methods 
 Linq 
 Task-based parallelism 
 Access to powerful Base Class Library
var keyword 
 Java 
VeryLongClassName<VeryLongParameterName> variable 
= new VeryLongClassName<VeryLongParameterName>(); 
 C# 
var variable = new VeryLongClassName<VeryLongParameterName>(); 
var hello = „Hello Android”;
Properties 
 Java 
private int foo; 
public int getFoo() 
{ 
return foo; 
} 
protected void setFoo(int foo) 
{ 
this.foo = foo; 
} 
 C# 
public int Foo 
{ 
get; protected set; 
}
Events 
 Java (Android) 
Listeners 
button.setOnClickListener( 
new OnClickListener() { 
@Override 
public void onClick(View v) 
{ 
label.setText(„Hello, Android); 
} 
} 
 C# 
button.Click += (s, e) => 
{ 
label.Text = „Hello, Android”; 
}; 
Listeners are supported 
but they must be 
implemented as a part of 
named class
Object/collection initializers 
 Java 
Button button = new Button(this); 
button.setText(„Click me”); 
button.setFoo(„abc”); 
button.setBar(123); 
 C# 
Button button = new Button(this) 
{ 
Text = „Click me”, 
Foo = „abc”, 
Bar = 123 
};
Extension methods 
 Add methods to object instances without inheritance 
class SealedClassExtensions 
{ 
public static void ExtensionMethod(this SealedClass instance) 
{ 
// implementation 
} 
} 
SealedClass instance = new SealedClass(); 
instance.ExtensionMethod(); 
or 
SealedClassExtensions.ExtensionMethod(instance);
Linq – Language Integrated Query 
class User 
{ 
… 
public int Age { get; set; } 
public string City { get; set; } 
} 
class City 
{ 
… 
public string Name { get; set; } 
public string PostalCode 
{ 
get; set; 
} 
} 
List<User> users = LoadUsers(); 
List<City> cities = LoadCities(); 
var filteredUsers = 
from user in users 
join city in cities 
on user.City equals city.Name 
where user.Age >= 18 
orderby user.Age descending 
select new { 
Age = user.Age, 
City = user.City, 
PostalCode = city.PostalCode 
}; 
 Different data sources are 
supported (collections, XML, 
databases)
Task-based parallelism 
async Task<ParsedResult> DownloadAndParseDataAsync() 
{ 
Task<string> downloadTask = DownloadDataAsync(); 
IndependentMethod(); 
string textData = await downloadTask(); 
ParsedResult result = ParseData(textData); 
return result; 
} 
 async and await keywords 
 Async task should have Async method name suffix and must return 
Task or Task<T> result
Base Class Library 
 System – basic reference and value types, array handling, math functions 
 System.Collections*– generic & nongeneric collections 
 System.ComponentModel* - attributes, type converters, data binding 
 System.Data* - database access, SQLite support 
 System.Diagnostics – logging, tracing, interaction with processes 
 System.Globalization – culture support 
 System.IO – streams, file system, compression 
 System.Json – JSON processing 
 System.Linq – Linq support 
 System.Net – support for the most popular network protocols 
 System.Numerics –BigInteger, complex numbers 
 System.Reflection – operations on assembly metadata 
 System.Runtime - serialization 
 System.Text – encoding utils, regexp 
 System.Threading – multithreaded programming 
 System.Xml*– XML processing
Xamarin Forms 
 Native UI using single code base 
 UI components (pages, layouts, controls, animations) 
 Write custom components or extend existing 
 Views defined in C# code or XAML 
 Binding and MVVM support 
Source: http://xamarin.com/forms
MVVM pattern 
 Model – data source 
 View – native UI (no code behind) 
 ViewModel - logic 
 Uses data binding 
 Separate UI and logic 
 Easy testing 
 MvvmCross, MVVM Light
Other Xamarin products 
 Test Cloud 
– run apps on real Android devices in the cloud 
- test scripts written using Calabash framework with 
Cucumber (Ruby) or in C# 
- reports with logs, screenshots and performance metrics 
- integration with CI systems (Jenkins, TeamCity…) 
 Insights 
- track exceptions and crashes in apps 
- find out which sequence of events lead to the crash 
- online backend with issues browser and statistics 
 University 
- live online classes, certification exams
Library sources 
 Codeplex (http://www.codeplex.com) 
 Github (https://github.com) 
 Nuget (https://www.nuget.org) 
 Component Store (https://components.xamarin.com)
Gamedev 
 MonoGame – multiplatform MS XNA port 
(http://www.monogame.net) 
 Cocos2D-XNA – Cocos2D C# port 
(http://www.cocos2dxna.com) 
 CocosSharp - Cocos2D-XNA fork with better API 
(https://github.com/mono/CocosSharp) 
 Delta Engine - http://deltaengine.net 
 WaveEngine - http://waveengine.net
Disadvantages 
 Developer must be familiar with C#, .NET and target 
platforms 
 Generated APK size 
 Native platform bugs + Xamarin bugs = new bugs 
 Cannot use C# code in native projects (C++, Java, 
Objective C, Swift) 
 Mac device is required for iOS apps, Windows 8 device 
is required for Windows Phone apps
Pricing 
 Starter – free but very limited (app size, cannot 
compile apps using Xamarin Forms) 
 Indie - $25/month or $300/year, free for students  
 Business - $83/month or $999/year, supports Visual 
Studio 
 Enterprise - $158/month or $1899/year, additional 
components and support 
 Special offer for startups and small companies
Questions?

More Related Content

Similar to Introduction to Xamarin Mobile Platform

Android Overview (Karlsruhe VKSI)
Android Overview (Karlsruhe VKSI)Android Overview (Karlsruhe VKSI)
Android Overview (Karlsruhe VKSI)Lars Vogel
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindBeMyApp
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastBartosz Kosarzycki
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxEelco Visser
 
Going Desktop with Electron
Going Desktop with ElectronGoing Desktop with Electron
Going Desktop with ElectronLeo Lindhorst
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyUlrich Krause
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroMohammad Shaker
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonRichard Rabins
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDXJussi Pohjolainen
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDXJussi Pohjolainen
 
Android101 - Intro and Basics
Android101 - Intro and BasicsAndroid101 - Intro and Basics
Android101 - Intro and Basicsjromero1214
 
Titanium appcelerator my first app
Titanium appcelerator my first appTitanium appcelerator my first app
Titanium appcelerator my first appAlessio Ricco
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.comJUG Genova
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioGünter Obiltschnig
 

Similar to Introduction to Xamarin Mobile Platform (20)

Lecture1
Lecture1Lecture1
Lecture1
 
PPT Companion to Android
PPT Companion to AndroidPPT Companion to Android
PPT Companion to Android
 
Android Overview (Karlsruhe VKSI)
Android Overview (Karlsruhe VKSI)Android Overview (Karlsruhe VKSI)
Android Overview (Karlsruhe VKSI)
 
Porting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mindPorting and Maintaining your C++ Game on Android without losing your mind
Porting and Maintaining your C++ Game on Android without losing your mind
 
React native
React nativeReact native
React native
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
 
Introduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fastIntroduction to Flutter - truly crossplatform, amazingly fast
Introduction to Flutter - truly crossplatform, amazingly fast
 
Software Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & SpoofaxSoftware Language Design & Engineering: Mobl & Spoofax
Software Language Design & Engineering: Mobl & Spoofax
 
Going Desktop with Electron
Going Desktop with ElectronGoing Desktop with Electron
Going Desktop with Electron
 
Electron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easyElectron - cross platform desktop applications made easy
Electron - cross platform desktop applications made easy
 
C++ Windows Forms L01 - Intro
C++ Windows Forms L01 - IntroC++ Windows Forms L01 - Intro
C++ Windows Forms L01 - Intro
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soon
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Cluster Computing Web2 Sept2009
Cluster Computing Web2 Sept2009Cluster Computing Web2 Sept2009
Cluster Computing Web2 Sept2009
 
Android101 - Intro and Basics
Android101 - Intro and BasicsAndroid101 - Intro and Basics
Android101 - Intro and Basics
 
Titanium appcelerator my first app
Titanium appcelerator my first appTitanium appcelerator my first app
Titanium appcelerator my first app
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
 
Programming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.ioProgramming IoT Gateways in JavaScript with macchina.io
Programming IoT Gateways in JavaScript with macchina.io
 
Docker practical solutions
Docker practical solutionsDocker practical solutions
Docker practical solutions
 

Recently uploaded

W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...software pro Development
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Introduction to Xamarin Mobile Platform

  • 1. Dominik Minta dominik@minta.it Poznań Android Developer Group Meetup #3
  • 2. Problem – typical application  Multiplatform – Android, iOS, Windows Phone  Tasks: - downloading, parsing and storing data (JSON, XML, images) from webservices in local database (SQL) - filtering and presenting data to user in a convenient form (lists, maps) - sharing content with social network (Facebook, Twitter etc.) - utilizing location services - taking a picture with camera  Some features are available offline
  • 3. Typical solutions Native applications  Full access to platform capabilities (camera, GPS, accelerometer etc.)  Native UI  High performance (native code, hardware access)  Separate UI design and source code for each platform  Different libraries for the same task (downloading and displaying images, social network integration, handling network protocols etc.)  Developers must be familiar with each supported platform Hybrid applications  Many frameworks to choose from (Cordova/PhoneGap, ionic, Titanium, Sencha Touch…)  Single code base  Low entry level (HTML, CSS, JS)  Can be extended using native code  Partial access to platform capabilities out-of-the-box  HTML5 UI  Poor performance and responsiveness for extensive UI  Problems with webview on different platforms  JS debugging = pain
  • 4. Xamarin Mobile Platform  Shared code on each platform (also UI!)  Full native API access  Native performance  Modern programming language – C# (F# also supported)  Multiplatform libraries  Works with existing libraries  Xamarin Studio multiplatformIDE (Linux, MacOS X, Windows)  Visual Studio plugin  Good documentation, community and support  http://xamarin.com
  • 5. Applications built with Xamarin  Bastion  Calca  Draw a Stickman: EPIC  iCircuit  Infinite Flight  Legimi  Nokia MixRadio  Rdio  TouchDraw  Vezma Sources: http://www.monogame.net/showcase/ http://icircuitapp.com/ http://elevenworks.com/
  • 6.  „Spotify for ebooks”  Ebook readers for Android, iOS, Windows Phone 7+, Windows 8 and Onyx e-ink devices  First app was running on Linux-based e-ink device using Mono runtime (2009)  Shared part of logic code (webservice communication, epub handling, DRM, local database, utility classes)  Native UI Source: legimi.com
  • 7. How Xamarin works on Android?  Applications and libraries are compiled to .NET bytecode (Intermediate Language) which is stored in .NET assemblies (DLL)  Unused code is removed  Generated application package (APK) is shipped with Mono Virtual Machine (native library for each supported platform – ARM, x86)  When user runs an application, Mono JIT (Just-in-Time) compiler compiles IL to native code and executes it  Mono runtime handles memory allocation, garbage collection and serves as a bridge between user code and native API
  • 8. Why you should learn C#?  var keyword  Properties  Events  Operator overloading  Indexers  Partial classes  „True” generics  Value types  Object/collection initializers  Extension methods  Linq  Task-based parallelism  Access to powerful Base Class Library
  • 9. var keyword  Java VeryLongClassName<VeryLongParameterName> variable = new VeryLongClassName<VeryLongParameterName>();  C# var variable = new VeryLongClassName<VeryLongParameterName>(); var hello = „Hello Android”;
  • 10. Properties  Java private int foo; public int getFoo() { return foo; } protected void setFoo(int foo) { this.foo = foo; }  C# public int Foo { get; protected set; }
  • 11. Events  Java (Android) Listeners button.setOnClickListener( new OnClickListener() { @Override public void onClick(View v) { label.setText(„Hello, Android); } }  C# button.Click += (s, e) => { label.Text = „Hello, Android”; }; Listeners are supported but they must be implemented as a part of named class
  • 12. Object/collection initializers  Java Button button = new Button(this); button.setText(„Click me”); button.setFoo(„abc”); button.setBar(123);  C# Button button = new Button(this) { Text = „Click me”, Foo = „abc”, Bar = 123 };
  • 13. Extension methods  Add methods to object instances without inheritance class SealedClassExtensions { public static void ExtensionMethod(this SealedClass instance) { // implementation } } SealedClass instance = new SealedClass(); instance.ExtensionMethod(); or SealedClassExtensions.ExtensionMethod(instance);
  • 14. Linq – Language Integrated Query class User { … public int Age { get; set; } public string City { get; set; } } class City { … public string Name { get; set; } public string PostalCode { get; set; } } List<User> users = LoadUsers(); List<City> cities = LoadCities(); var filteredUsers = from user in users join city in cities on user.City equals city.Name where user.Age >= 18 orderby user.Age descending select new { Age = user.Age, City = user.City, PostalCode = city.PostalCode };  Different data sources are supported (collections, XML, databases)
  • 15. Task-based parallelism async Task<ParsedResult> DownloadAndParseDataAsync() { Task<string> downloadTask = DownloadDataAsync(); IndependentMethod(); string textData = await downloadTask(); ParsedResult result = ParseData(textData); return result; }  async and await keywords  Async task should have Async method name suffix and must return Task or Task<T> result
  • 16. Base Class Library  System – basic reference and value types, array handling, math functions  System.Collections*– generic & nongeneric collections  System.ComponentModel* - attributes, type converters, data binding  System.Data* - database access, SQLite support  System.Diagnostics – logging, tracing, interaction with processes  System.Globalization – culture support  System.IO – streams, file system, compression  System.Json – JSON processing  System.Linq – Linq support  System.Net – support for the most popular network protocols  System.Numerics –BigInteger, complex numbers  System.Reflection – operations on assembly metadata  System.Runtime - serialization  System.Text – encoding utils, regexp  System.Threading – multithreaded programming  System.Xml*– XML processing
  • 17. Xamarin Forms  Native UI using single code base  UI components (pages, layouts, controls, animations)  Write custom components or extend existing  Views defined in C# code or XAML  Binding and MVVM support Source: http://xamarin.com/forms
  • 18. MVVM pattern  Model – data source  View – native UI (no code behind)  ViewModel - logic  Uses data binding  Separate UI and logic  Easy testing  MvvmCross, MVVM Light
  • 19. Other Xamarin products  Test Cloud – run apps on real Android devices in the cloud - test scripts written using Calabash framework with Cucumber (Ruby) or in C# - reports with logs, screenshots and performance metrics - integration with CI systems (Jenkins, TeamCity…)  Insights - track exceptions and crashes in apps - find out which sequence of events lead to the crash - online backend with issues browser and statistics  University - live online classes, certification exams
  • 20. Library sources  Codeplex (http://www.codeplex.com)  Github (https://github.com)  Nuget (https://www.nuget.org)  Component Store (https://components.xamarin.com)
  • 21. Gamedev  MonoGame – multiplatform MS XNA port (http://www.monogame.net)  Cocos2D-XNA – Cocos2D C# port (http://www.cocos2dxna.com)  CocosSharp - Cocos2D-XNA fork with better API (https://github.com/mono/CocosSharp)  Delta Engine - http://deltaengine.net  WaveEngine - http://waveengine.net
  • 22. Disadvantages  Developer must be familiar with C#, .NET and target platforms  Generated APK size  Native platform bugs + Xamarin bugs = new bugs  Cannot use C# code in native projects (C++, Java, Objective C, Swift)  Mac device is required for iOS apps, Windows 8 device is required for Windows Phone apps
  • 23. Pricing  Starter – free but very limited (app size, cannot compile apps using Xamarin Forms)  Indie - $25/month or $300/year, free for students   Business - $83/month or $999/year, supports Visual Studio  Enterprise - $158/month or $1899/year, additional components and support  Special offer for startups and small companies