Developing Cross-Platform.NET Apps with ArcGIS Runtime



Similar documents
QML and JavaScript for Native App Development

Building cross-platform Modern Apps: the Design perspective. Amit Bahree, Senior Director,

Building cross-platform mobile apps with Xamarin

Lecture 4 Cross-Platform Development. <lecturer, date>

Xamarin Cross-platform Application Development

Build apps your users will love with Xamarin. Mobile Edge 11 Nov 2015

Mumbai, India 1 kunalprajapati365@gmail.com 2 phadakedhananjay@gmail.com 3 archit.poddar@gmail.com

Take Your Team Mobile with Xamarin

CROSS-PLATFORM MOBILE APPLICATION DEVELOPMENT WITH XAMARIN.FORMS

A Way Out of the Mobile App Development Conundrum

/// CHOOSING THE BEST MOBILE TECHNOLOGY. Overview

Microsoft Visual Studio: Developing Cross-Platform Apps With C# Using Xamarin

BASIC COMPONENTS. There are 3 basic components in every Apache Cordova project:

Developing and deploying mobile apps

An Analysis of Mobile Application Development Approaches

Cross-Platform Tools

WHITEPAPER. Pros & cons of native vs cross-platform mobile development with Xamarin

Cross-Platform Development: Target More Platforms and Devices with a Minimal Amount of Source Code

Best practices building multi-platform apps. John Hasthorpe & Josh Venman

Multi-Platform Mobile Application Development Analysis. Lisandro Delía Nicolás Galdámez Pablo Thomas Leonardo Corbalán Patricia Pesado

BELATRIX SOFTWARE. Why you should be moving to mobile Cross Platform Development? Introduction

Developing Apps with the ArcGIS Runtime SDK for Android. Ben Ramseth Esri Inc. Instructor Technical Lead

Software Development Interactief Centrum voor gerichte Training en Studie Edisonweg 14c, 1821 BN Alkmaar T:

Building native mobile apps for Digital Factory

Mobile App Infrastructure for Cross-Platform Deployment (N11-38)

ArcGIS Web Mapping. Sam Berg, esri

POINT-TO-POINT vs. MEAP THE RIGHT APPROACH FOR AN INTEGRATED MOBILITY SOLUTION

Mobile Application Development

How To Develop A Mobile App With Phonegap

Developing multi-platform mobile applications: doing it right. Mihail Ivanchev

Mobile Development Frameworks Overview. Understand the pros and cons of using different mobile development frameworks for mobile projects.

Leveraging Partners and Open Source Technology in your Mobility Strategy. emids webinar Thursday, August 11, :00 pm 2:00 pm EDT

True Web Application Management: Fixing the Gaps in EMM Solutions

Extending the Survey123 for ArcGIS Mobile App

SYST35300 Hybrid Mobile Application Development

Viability of developing cross-platform mobile business applications using a HTML5 Mobile Framework

Evaluation of Xamarin Forms for MultiPlatform Mobile Application Development

Avanade & Xamarin: The fast path to mobile success.

27th Embarcadero Developer Camp General Session

Client Overview. Engagement Situation

HYBRID APPLICATION DEVELOPMENT IN PHONEGAP USING UI TOOLKITS

Evaluating Cross-Platform Development Approaches (WORA Tools ) for Mobile Applications

Beginner s Android Development Tutorial!

Survey, Comparison and Evaluation of Cross Platform Mobile Application Development Tools

A Guide to Mobile App Development Platforms

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

Development of mobile applications for multiple platforms

The full setup includes the server itself, the server control panel, Firebird Database Server, and three sample applications with source code.

Debugging Mobile Apps

Bridging the Gap: from a Web App to a Mobile Device App

Cross-Platform Mobile Apps Solution

Considerations Regarding the Cross-Platform Mobile Application Development Process

Making Mobile a Reality

ANDROID APP DEVELOPMENT: AN INTRODUCTION CSCI /19/14 HANNAH MILLER

ArcGIS Platform. An Integrated System. Portal

Android Mobile App Building Tutorial

Beginning Nokia Apps. Development. Qt and HTIVIL5 for Symbian and MeeGo. Ray Rischpater. Apress. Daniel Zucker

ADF Mobile Overview and Frequently Asked Questions

Cross-Platform Phone Apps & Sites with jquery Mobile

HTML5 / NATIVE / HYBRID

Operations Dashboard for ArcGIS: Extending the Functionality

ORACLE ADF MOBILE DATA SHEET

Xamarin a Cross Platform App Development Technology. A white paper on Fundamentals and Implementations of Xamarin Cross platform Mobile Technology

Petroleum Web Applications to Support your Business. David Jacob & Vanessa Ramirez Esri Natural Resources Team

HTML5, The Future of App Development

Overview of CS 282 & Android

How To Develop A Mobile Application On An Android Device

Essential Mapping Apps

Developing a multiplatform solution for mobile learning

ArcGIS Viewer for Silverlight An Introduction

Take full advantage of IBM s IDEs for end- to- end mobile development

How to pick the right development model for your next mobile project

Dynamic Web Programming BUILDING WEB APPLICATIONS USING ASP.NET, AJAX AND JAVASCRIPT

Splunk for.net Developers

Collaborative Open Market to Place Objects at your Service

Android Basics. Xin Yang

Accelerating Business Value by

Developing multidevice-apps using Apache Cordova and HTML5. Guadalajara Java User Group Guillermo Muñoz Java Developer

The Decaffeinated Robot

Retool your HTML/JavaScript to go Mobile

How To Use Titanium Studio

Windows Presentation Foundation (WPF)

New Features in XE8. Marco Cantù RAD Studio Product Manager

CrossPlatform ASP.NET with Mono. Daniel López Ridruejo

HybriDroid: Analysis Framework for Android Hybrid Applications

Adobe Flash Player and Adobe AIR security

The Most Popular UI/Apps Framework For IVI on Linux

Developing Mapping Applications with ArcGIS Runtime SDK for Windows Mobile. Jay Chen Justin Colville

Transcription:

Esri Developer Summit March 8 11, 2016 Palm Springs, CA Developing CrossPlatform.NET Apps with ArcGIS Runtime Antti Kajanus Thad Tilton

Session overview Crossplatform options Xamarin Why it s a good option Forms versus Native Incorporating existing.net code Strategies for sharing code Good design to isolate platformspecific code Compiler conditionals Dependency injection Sharing ArcGIS Runtime implementation

Crossplatform The good, the bad, and the ugly Good Makes your app available to more users Enforces good design patterns Bad User experience and quality of your app may vary Requires more testing Ugly Creating platformspecific UIs Handling platform idiosyncrasies (security, bugs, etc)

Options for creating crossplatform apps Html5 and JavaScript: Sencha, PhoneGap, Appcelerator Titanium C# Development: Xamarin, Alpha Anywhere, Unity 3D Crossplatform ArcGIS Runtime SDKs Java,.NET Qt (C++ / QML) Xamarin

Why Xamarin is a good option Fully native ios and Android apps Exposes all functionality of the ios and Android APIs Ability to share the majority of an app s code (60100%) Performance: code is compiled to native binary, not interpreted Immediate updates to support ios and Android releases Support for 3rdparty.NET libraries Visual Studio and C#!

Xamarin s approach Xamarin.iOS / Xamarin.Android (Native) ios + C# Android + C# Windows + C# Shared C# code Shared C# codebase 100% native API access High performance

Xamarin s approach Xamarin.Forms Shared UI code Shared C# code and even more shared code!

It s native ARM Binary NET C# Bindings NET C# Bindings AOT.APP IL + JIT Compile & link.apk It feels native because it is!

Demo: Run a Xamarin app Antti Kajanus

Xamarin options Two primary approaches Xamarin Forms: lots of shared code, less control Use XAML to define the UI Rendered appropriately for each platform Lowest common denominator UI elements Basic crossplatform functionality Xamarin Native: less shared code, more control Customize UIs with platformspecific elements and designers More platformspecific control Native behavior for user interactions

Which one to pick? Xamarin.Forms Xamarin.iOS / Xamarin.Android Apps that require little platformspecific functionality Apps that uses many platformspecific APIs Apps where code sharing is more important than custom UI Apps where custom UX is more important than code sharing Time until delivery Apps that require specialized interaction

Xamarin development environments Windows or Mac Mac OS X Xamarin Studio Windows Visual Studio Xamarin Studio Xamarin Native ios Requires Mac build host Android Xamarin Forms ios Requires Mac build host Android Windows * Mac * * Not available for ArcGIS Runtime for Xamarin apps

Organizing your Xamarin code Individual project for each platform UI and app code ( Views ) One project for shared code (core) Portable Class Library Shared project Note: If using Xamarin Forms, UI (.xaml) can be shared

The ArcGIS Runtime for Xamarin Why codesharing works One Common API surface Same API on Windows Desktop, Windows Universal Platform, ios, and Android Same underlying code, same functionality Most code becomes shareable crossplatform Streamlined Development Changes inherently apply to all platforms All platforms remain in sync Tooling in Visual Studio Shared projects *

Demo: UWP Portal Browser project Antti Kajanus

Good design Is not optional for crossplatform apps!

Organizing your code Platform specific layers User Interface: UI elements and associated controllers Application: Platform specific (nonshared) application logic Common / shareable layers Business: Models and business logic Data: Persisted information in a SQLite database, XML, plain text, etc. Data Access: Logic that wraps the Data to provide CRUD access Service Access: Logic that wraps access to remote services (REST, e.g.)

Xamarin: Sharing code Isolate platformspecific code ios App Application Layer UI Layer Xamarin.iOS SDK assemblies Shared Code Data Layer Databases Data Access Layer Service Access Layer Android App Business Layer Application Layer UI Layer Models Xamarin.Android SDK assemblies Windows Phone App Application Layer UI Layer Services Reference Windows Phone SDK assemblies

Useful design patterns Model View Controller (MVC) and Model View ViewModel (MVVM): Separates application layers according to the UI (view), the data it displays (model), and business / interaction logic (controller, viewmodel). Dependency Injection (Provider): Allows shared code to be written against an abstract class (or interface). Each app passes an instance that provides platformspecific implementation of the abstract class. Singleton: Ensures that only a single instance of an object exists (portal connection, for example). Façade: Provides a simplified view of complex operations by wrapping them with an API. WidgetManager.GetAllWidgets might serve as a façade to a complex operation that retrieves widgets, for example.

Sharing code Adding platform specific logic ios App Application Layer UI Layer IPlatformSpecific implementation Shared Code Data Layer Data Access Layer Service Access Layer Business Layer Android App IPlatformSpecific Application Layer UI Layer Models IPlatformSpecific implementation Windows Phone App Dependency Injection Application Layer UI Layer IPlatformSpecific implementation

Shared projects Share code with several projects in your app solution Benefits Enables sharing of code between multiple projects Compiler directives (#if ANDROID ) for platformspecific code Can use platformspecific assembly references added to app projects Possible disadvantages Shared project produces no output assembly (*.dll) to share PCL

Sharing code Shared Project ios App Application Layer Shared Project Data Access Layer Business Layer Service Access Layer Models Data Layer UI Layer #if IOS // iosspecific code #if ANDROID // Androidspecific code Android App Application Layer UI Layer #if WINDOWS_PHONE // WPspecific code Windows Phone App Compiled into each app Application Layer UI Layer

Demo: Explore a Xamarin Solution Antti Kajanus

Strategies for successful sharing Data Use ArcGIS Runtime geodatabases when possible Use SQLite to store app data Supported natively by ios and Android C# SQLite assembly (open source) for Windows Phone ADO.NET code for data access Rather than using native APIs Reference System.Data.dll and Mono.Data.Sqlite.dll using System.Data; using Mono.Data.Sqlite; //... string dbpath = Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.Personal), "items.db3"); bool exists = File.Exists (dbpath); if (!exists) SqliteConnection.CreateFile (dbpath); var connection = new SqliteConnection ("Data Source=" + dbpath); connection.open ();

Strategies for successful sharing File access Beware of platformspecific aspects of file access Restricted access to certain files or locations Ability to access external or shared data Asynchronous only file operations Use classes in System.IO string filepath = System.IO.Path.Combine ( Environment.GetFolderPath (Environment.SpecialFolder.Personal), "MyFile.txt"); System.IO.File.WriteAllText (filepath, "Contents of text file"); Console.WriteLine (System.IO.File.ReadAllText (filepath));

Demo: Crossplatform Portal Browser Antti Kajanus

Strategies for successful sharing Network operations Proactively handle unavailable connectivity Beware of platformspecific aspects of network access Restricted download sizes (20 meg max for ios on 3G, for example) Asynchronous only network operations (Windows Phone) Use System.Net.WebClient, System.Net.Http.HttpClient and System.Net.HttpWebRequest var webclient = new System.Net.WebClient (); webclient.downloadstringcompleted += (sender, e) => { var resultstring = e.result; // do something with downloaded string }; webclient.encoding = System.Text.Encoding.UTF8; webclient.downloadstringasync (new Uri ("http://someserver.com/file.xml"));

Strategies for successful sharing Threading Platformspecific syntax for marshaling to the UI thread Handle with Provider pattern or with compiler conditionals Tasks created with the Parallel Task Library return to their calling thread TaskScheduler.FromCurrentSynchronizationContext gets thread the task was called on using System.Threading.Tasks; void MainThreadMethod () { Task.Factory.StartNew (() => wc.downloadstring ("http://...")).continuewith ( t => label.text = t.result, TaskScheduler.FromCurrentSynchronizationContext() ); }

Demo: Crossplatform Portal Browser (Forms) Antti Kajanus

Summary Xamarin allows you to build native apps for Andriod and ios. Windows platforms that consume the same shared code can be included. ArcGIS Runtime SDK for Xamarin is consistent across supported platforms and hides platforms idiosyncrasies from you. Good design enables the most efficient code sharing. Keep UI and appspecific code in projects that are distinct from the shared code. Separation of concerns, Dependency Injection, Compiler conditionals are specific techniques that help in crossplatform development.

Thank you Questions?