arcgis runtime: building cross-platform apps...cross platform java development • “write once,...
TRANSCRIPT
ArcGIS Runtime:Building Cross-Platform AppsMark BairdLuke SmallwoodRex Hansen
Thank You to Our Sponsors
Agenda
• Cross-platform review• ArcGIS Runtime cross-platform options
- Java- Qt- .NET
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
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
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
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
Mark Baird
Java
Luke Smallwood
Qt
Rex Hansen
.NET Xamarin
Mark BairdJava
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
API Architecture
C++ Core
Interop
Java Common API
Java SE API Android API
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>
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
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
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
Luke SmallwoodQt
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?
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
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
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
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)
QML APIExample QML API code
Highlyreadable JSON/CSS-like syntax
Imperative JavaScript Code to handle events
Dynamic property binding
Declarative UI elements
ArcGIS Runtime
Demo - Getting started
Qt SDK
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
Qt Quick Controls 1
• macOS • Android – Nexus 5
Native Look and feel
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
Demo
Qt Quick Controls
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
Rex Hansen.NET Xamarin
.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
.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
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
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
Solution Overview
MyApp.Android MyApp.iOS MyApp.WPFMyApp.UWP
MyApp.Xamarin.Shared
MyApp.Shared
Xamarin Demo
github.com / Esri / arcgis-runtime-demos-dotnet
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
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
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
Questions?developers.arcgis.com/arcgis-runtime