arcgis runtime: building cross-platform apps...cross platform java development • “write once,...

40
ArcGIS Runtime: Building Cross-Platform Apps Mark Baird Luke Smallwood Rex Hansen

Upload: others

Post on 30-May-2020

28 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

ArcGIS Runtime:Building Cross-Platform AppsMark BairdLuke SmallwoodRex Hansen

Page 2: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Thank You to Our Sponsors

Page 3: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Agenda

• Cross-platform review• ArcGIS Runtime cross-platform options

- Java- Qt- .NET

Page 4: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Native vs Web?• Native apps

• App installed on the device• Use Platform / Operating System APIs• Best performance and device integration • Support for connected and offline workflows• Work well when you have the ability to determine devices• Use ArcGIS Runtime SDKs to create native apps

• Web apps• Web site/app downloaded from a server• Best for wider range of users on unknown devices• Use the ArcGIS API for JavaScript to create web client solutions

• User experience and capabilities increasingly blurred as technologies evolve

http://esriurl.com/ChoosingAnAPI

Page 5: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Native app cross-platform considerations

• Benefits- Share application code- Enforces good design patterns- Makes your app available to more users

• Challenges- Testing- User experience of your app may vary- Handling platform idiosyncrasies (security, bugs, etc)- Development cost

Page 6: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Building Native Apps on Multiple Platforms

• How do you choose a cross platform SDK?- Business, technical, and user requirements- Developer skillset

• Multiple options available- Oracle Java- Qt Company- Microsoft .NET/Xamarin

Page 7: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

ArcGIS Runtime cross-platform options

• All Runtime APIs built on common Runtime core

Qt / QMLAndroid iOS

JavamacOS

.NET / Xamarin

C++ runtime core

WindowsLinux macOSAndroid iOS UWP

x86 x64 ARMDirectX

OpenGL

QtJava .NET

Page 8: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Mark Baird

Java

Luke Smallwood

Qt

Rex Hansen

.NET Xamarin

Page 9: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Mark BairdJava

Page 10: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Cross platform Java Development

• “Write once, run anywhere”• ArcGIS Runtime SDK for Java targets

Windows, Mac, and Linux desktops• Sits on the ArcGIS Runtime core

architecture (C++) via JNI• JavaFX for building modern, native-looking

GUIs• Massive ecosystem of mature, open-

source libraries to use

Page 11: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

API Architecture

C++ Core

Interop

Java Common API

Java SE API Android API

Page 12: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

JavaFX

• Layout uses a native window• Styling with CSS• Programmatic and markup (FXML) options

for layout

Be mindful of file paths• C:\Users\Tyler\Projects\MyData.geodatabase• /Users/Tyler/Projects/MyData.geodatabase

<StackPane fx:controller="com.esri.samples.mysample.SampleController"xmlns:fx="http://javafx.com/fxml" stylesheets="/css/style.css">

<MapView fx:id=“mapView"/> <!-- SDK control --><HBox StackPane.alignment="TOP_CENTER" maxWidth="200" maxHeight="50" spacing="5" styleClass="panel-region">

<Label text=“Click me: "/><Button fx:id=“myButton" onAction=“#myEvent"/>

</HBox></StackPane>

Page 13: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Distribution

IDE

JAR file

Windows

JRE

JAR file

Runtime Core

.dll file

Linux

JRE

JAR file

Runtime Core

.so file

Mac OS X

JRE

JAR file

Runtime Core

.dylib file

Development environment Cross platform deployments

Compile

Deploy

Page 14: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Demo

javapackager -deploy -native -outdir packages -outfile SampleViewer-srcDir ./ -srcfiles java-se-sample-viewer-1.0.jar -srcfiles jniLibs -srcfiles resources -srcfiles samples-data -appclass com.esri.sampleviewer.App -name "SampleViewer" -title "Sample Viewer“

An App for Windows, Linux, and Mac

Page 15: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Summary

• Pros- IDE and JDK are free- Deployments can be identical for ALL platforms- JavaFX apps style for the platform

• Cons- Clients must have Java installed- Not targeted for mobile or web apps

Page 16: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Luke SmallwoodQt

Page 17: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

ArcGIS Runtime SDK for Qt: Topics:

• What is Qt?• Which platforms can I build for?• How do I get set up?• What language do I use?• What will my apps look like?• What are the Pros and Cons?

Page 18: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

What is Qt?

The Qt Company – www.qt.io

Code less, create more, deploy everywhere• A complete cross-platform software experience

- C++ libraries- Ready-made UI elements- Tooling

• Over 1 million developers (indie, corporate) worldwide• Open-source community

Page 19: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Which platforms can I build for?

• Windows – x86, x64• Linux – x64• macOS – x64• Android – armv7, x86• iOS – armv7, arm64, sim• Universal Windows Platform (UWP)

ArcGIS Runtime SDK for Qt

Page 20: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

How do I get set up?• Setup Qt:

- Create account- License / open-source?- Install kits

• Setup ArcGIS Runtime SDK for Qt- https://developers.arcgis.com/qt/latest/

• Compiler, SDK dependencies- iOS: Xcode compiler- Windows: Visual Studio compiler, debugging tools- Linux: GCC compiler- Android: Android NDK and SDK

• IDE- Qt Creator

Page 21: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

What language do I use?ArcGIS Runtime SDK for Qt

2 APIs: same Runtime Core (C++)• C++ API

- Modern C++ language (C++ 11)- Fast performance

• QML API- Qt Quick (QML) for UI- Declarative language- Imperative JavaScript business logic code- AppStudio (Survey 123)

Page 22: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

QML APIExample QML API code

Highlyreadable JSON/CSS-like syntax

Imperative JavaScript Code to handle events

Dynamic property binding

Declarative UI elements

ArcGIS Runtime

Page 23: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Demo - Getting started

Qt SDK

Page 24: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

What will my Apps look like?ArcGIS Runtime SDK for Qt

Choice of UI framework:• C++ API

- Widgets (desktop based)- QtQuick (declarative, mobile and desktop)

• QML API- Business logic and UI in QtQuick

Page 25: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Qt Quick Controls 1

• macOS • Android – Nexus 5

Native Look and feel

Page 26: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Qt Quick Controls 2

• Available Styles- Default style- Material style

- Google’s guidelines- Universal style

- Microsoft’s guidelines- Fusion style

- Desktop-oriented look and feel- Imagine style

- Based on image assets

• Default style• Material style• Universal style• Fusion style• Imagine styleStyled look and feel

Page 27: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Demo

Qt Quick Controls

Page 28: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

What are the Pros and Cons?

Pros- Write once- Same APIs and code- Consistent, styled look and feel- Access to device sensors- Open-source community- QML or C++ - based on experience

Cons- Incomplete native APIs

- Common abstraction API for iPhone and Android SDKs- Won’t match the look and feel of the native platform- Qt framework can increase apps size

ArcGIS Runtime SDK for Qt

Page 29: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Rex Hansen.NET Xamarin

Page 30: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

.NET cross-platform with Xamarin

• Xamarin enables cross-platform development for .NET• C# for Android and iOS• Uses the Mono .NET framework• Compiles into a native Android or iOS app• Exposes all APIs in Android and iOS SDKs• Re-use most of your .NET code across Android, iOS, and Windows• UI code is platform specific• Device code is platform specific (e.g. Bluetooth, GPS, sensors)• Take a look at Xamarin Essentials: https://github.com/xamarin/Essentials

Page 31: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

.NET cross-platform with Xamarin

• Xamarin.Forms- Cross-platform UI framework- UI is rendered using native controls of target platform- Use XAML or C# to create UI

• Can use combination of Xamarin ‘native’ and Xamarin.Forms• Other abstraction libraries can reduce platform-specific code

- Many available on NuGet.org

Page 32: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

What is ArcGIS Runtime SDK for .NET• Supports:

- Windows Presentation Foundation (WPF)- Universal Windows Platform (UWP)- Xamarin.Android- Xamarin.iOS- Xamarin.Forms (Android, iOS, and UWP)

• The same business logic code for all platforms- Use native platform UI framework- Or use Xamarin.Forms abstraction to share UI logic as well

Page 33: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

ArcGIS Runtime SDK for .NET & XamarinArchitecture Diagram

Win32Windows Runtime

iOS Android

ArcGIS Runtime Core (C++)

ArcGIS Runtime SDK for .NET (C#).NET Core.NET Framework

WPF UWP iOS Android

Internal

Public SDK

WPF UWP iOS Android Native UI

Common SDK• Maps, scenes, layers, symbols,

feature data, geocoding, routing, portal, rasters, offline/syncing, geometry, geometry engine…

• MapView, SceneView

Common UI

Where all the magic happens

Mono / Xamarin

Interop

Xamarin Forms

OS

.NET Standard

Page 34: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Solution Overview

MyApp.Android MyApp.iOS MyApp.WPFMyApp.UWP

MyApp.Xamarin.Shared

MyApp.Shared

Page 35: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Xamarin Demo

github.com / Esri / arcgis-runtime-demos-dotnet

Page 36: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Pros and Cons

• Pros: - Xamarin is free and Open Source

- Note: Visual Studio is not free for most commercial uses though- Target all platforms in a single IDE (Visual Studio), on a single OS*- Full access to all native platform APIs

• Cons:- Not 100% abstraction of all platform code- Significant technology stack- *You need a Mac for iOS deployment

Page 37: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

ArcGIS Runtime cross-platform options

• All Runtime APIs built on common Runtime core

Qt / QMLAndroid iOS

JavamacOS

.NET / Xamarin

C++ runtime core

WindowsLinux macOSAndroid iOS UWP

x86 x64 ARMDirectX

OpenGL

QtJava .NET

Page 38: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Summary

• How do you choose a cross platform SDK?- Understand expectations of your users- Understand skillset of your developers

• Options and ArcGIS Runtime SDKs- Oracle Java => ArcGIS Runtime SDK for Java- Qt Company => ArcGIS Runtime SDK for Qt- Microsoft Xamarin => ArcGIS Runtime SDK for .NET

Page 39: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops

Questions?developers.arcgis.com/arcgis-runtime

Page 40: ArcGIS Runtime: Building Cross-Platform Apps...Cross platform Java Development • “Write once, run anywhere” • ArcGIS Runtime SDK for Java targets Windows, Mac, and Linux desktops