Arcgis Runtime: Building Cross-Platform Apps Mark Baird Luke Smallwood Rex Hansen Thank You to Our Sponsors Agenda
Total Page:16
File Type:pdf, Size:1020Kb
ArcGIS Runtime: Building Cross-Platform Apps Mark Baird Luke Smallwood Rex 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 Java Qt / QML .NET / Xamarin Android Java iOS macOS Qt .NET C++ runtime core Android Linux iOS macOS Windows UWP DirectX x86 x64 ARM OpenGL Java Mark Baird Qt Luke Smallwood .NET Xamarin Rex Hansen Java Mark Baird 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 Java SE API Android API Java Common API Interop C++ Core 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 Deploy Windows Linux Mac OS X JAR file JRE JRE JRE Compile JAR file JAR file JAR file IDE Runtime Core Runtime Core Runtime Core .dll file .so file .dylib file Development environment Cross platform deployments Demo An App for Windows, Linux, and Mac 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“ 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 Qt Luke Smallwood 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? ArcGIS Runtime SDK for Qt • Windows – x86, x64 • Linux – x64 • macOS – x64 • Android – armv7, x86 • iOS – armv7, arm64, sim • Universal Windows Platform (UWP) 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 API Example QML API code Highly readable JSON/CSS- ArcGIS like syntax Runtime Declarative UI elements Dynamic property binding Imperative JavaScript Code to handle events Qt SDK Demo - Getting started 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 Native Look and feel • macOS • Android – Nexus 5 Qt Quick Controls 2 Styled look and feel • UniversalMaterialDefaultFusionImagine stylestyle style style • 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 Qt Quick Controls Demo What are the Pros and Cons? ArcGIS Runtime SDK for Qt 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 .NET Xamarin Rex Hansen .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 & Xamarin Architecture Diagram WPF UWP iOS Android Xamarin Forms Common UI WPF UWP iOS Android Native UI ArcGIS Runtime SDK for .NET (C#) • MapView, SceneView Public SDK .NET Framework .NET Core Mono / Xamarin Common SDK .NET Standard • Maps, scenes, layers, symbols, feature data, geocoding, routing, Interop portal, rasters, offline/syncing, geometry, geometry engine… Internal ArcGIS Runtime Core (C++) Where all the magic happens Windows Runtime OS Win32 iOS Android Solution Overview MyApp.Android MyApp.iOS MyApp.UWP MyApp.WPF 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 Java Qt / QML .NET / Xamarin Android Java iOS macOS Qt .NET C++ runtime core Android Linux iOS macOS Windows UWP DirectX x86 x64 ARM OpenGL 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 .