arcgis runtime sdk for android an introduction...map decoupled from mapview •content and...

52
ArcGIS Runtime SDK for Android An Introduction Dan O’Neill @jdoneill @doneill Xueming Wu @xuemingrocks

Upload: others

Post on 26-May-2020

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

ArcGIS Runtime SDK for AndroidAn Introduction

Dan O’Neill @jdoneill @doneillXueming Wu @xuemingrocks

Page 2: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Agenda

• Introduction to the ArcGIS Android SDK• Maps & Layers• Basemaps (Portal)• Location• Place Search• Routing• Authentication• Maps App• Quartz

Page 3: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Intro to SDKArcGIS Runtime SDK for Android

Page 4: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Introduction - Features of the ArcGIS Android SDK

• High performance Mapping and GIS capabilities

• Add and query content from your Organization

• Work offline with Basemaps and operational data

• Display maps in support spatial references

• Work with your device GPS

• Offline/Online routing

• Add graphics to maps

• Advanced geometric and spatial analysis operations

Page 5: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Introduction - What you get

• Rich mapping API for native Android app development- multiple ways to get API

• Android Library module (AAR) from a public maven repository- Preferred way to work with the SDK

• API Reference (Javadoc) & Guide documentation- developers.arcgis.com/android

• Suite of samples- GitHub samples

• User Forum- GeoNet/GIS Stack Exchange

• Blogs- Developer blogs for Android

Page 6: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Intro - How to get the SDK

• Android Studio- Official IDE for Android development- Based on IntelliJ IDEA- Project & File Structure

- Android project view• Gradle

- Android plugin for Gradle - Groovy Goodness- Flexible build system - custom build logic- Manage dependencies- Runs independent of Android Studio

Page 7: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Intro - How you get the SDK

Add repository URL

Add ArcGIS Android dependency

Page 8: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMOYour first android app - Hello World

Page 9: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Introduction - Samples

• Get an account (if you don’t already have one)• Fork the repo• Clone the repo locally• Import project into Android Studio• Run Sample

Open Source Samples

Page 10: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMOFork/Clone the Samples

Page 11: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Intro - What’s in the local SDK

• doc- API Ref - Javadoc

• legal- license info

• libs- dependency jars and native libs- local ArcGIS Android SDK Library Module AAR

• res- localization files

• resources- Military symbol dictionaries

• samples- archive snapshot of samples from GitHub

SDK Download

Page 12: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

SDK Intro - What’s exclusive in the local SDK

• Localization resources

- Localization of Popups

• Advanced Symbology symbol dictionaries

- APP6B and MIL2525 C symbol dictionaries

• Beta Analysis libs

- Native libs to support offline Spatial Analysis

Page 13: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps & Layers

Page 14: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps & Layers – Layer Types

• DynamicLayer• FeatureLayer• GraphicsLayer• GroupLayer• KmlLayer• RasterLayer• TiledLayer

Page 15: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps & Layers – Dynamic Layers

• Abstract Base Class• Sub-classes

- ArcGISDynamicMapServiceLayer- ArcGISImageServiceLayer- WMSLayer

Page 16: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps and Layers – TiledLayer

• Abstract Base Class• Direct sub-classes

- ArcGISLocalTiledLayer- TiledServiceLayer

• Indirect sub-classes- ArcGISTiledMapServiceLayer- BingMapsLayer- OpenStreetMapLayer- WMTSLayer

Page 17: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps & Layers – Graphics Layer

• Layer representing one or more Graphics- Dynamically display Graphics on a MapView- Graphics can be geometries or features

• MapView can contain one or more GraphicLayers

Page 18: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

BasemapsPortal

Page 19: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Basemaps

● ArcGIS Online provides a living atlas of the world○ Delivered as map service○ Freely available to anyone○ Include

■ World Imagery■ World Street Map■ World Topographic Map■ Ocean Basemap■ and more

Page 20: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Basemaps - From Portal

● Portal ○ Provides the connection information to the portal

● PortalInfo○ Name, logo, featured items, etc

● PortalGroup○ Represents a group in a portal

● PortalItem○ Represents an item in a portal

● PortalQueryParams○ Creates query parameters for finding content

● PortalQueryResult○ Results of the queries performed on a portal

How to get them in your app

Page 21: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Location

Page 22: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Location - GPS

• Use the power of your device to show where you are

• Knowing where you are allows apps to return smarter information back

• LocationDisplayManager provides the current location

- Device location on a Map

- Auto pan

- Listen to events

- pause

- resume

Page 23: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMOBASEMAP

&Location

https://github.com/Esri/arcgis-runtime-demos-android/tree/master/2015-DS/MaterialBaseMaps

Page 24: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Place Search

Page 25: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Place Search - Geocoding

• ArcGIS Online Geocoding service- Global coverage

• Locator uses this in default constructor• Find method allows for address and POI search• LocatorFindParameters

- Set source Country

- Point and radius parameters- Set Max returned location candidates

Locator.find(LocatorFindParameters)

Page 26: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Place Search – search suggestions

• LocationSuggestionParameters- Results in radius are promoted- Sorted by distance to point

- Results outside radius still returned

Locator.suggest(LocationSuggestionParameters)

Page 27: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Place Search – Toolkit Simplification

• ArcGIS Android Toolkit API• Provides GeocodeHelper class• Find location for a given address• Simplifies the workflow

- No need to set parameters and get result from a Locator

Page 28: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMOPlace Search

Page 29: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Routing

Page 30: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Routing API - Workflow

• Create a Route Task

• Set up Route Task Parameters

• Set stops

• Calculate route

• Get results

• Display route on map

• Get directions and display to user

Page 31: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMORouting

Page 32: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Authentication

Page 33: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Authentication

• When do you need to authenticate

- Access users private content

- Create and publish content

- Access premium content on ArcGIS Online

• Authentication modes

- Token-based

- HTTP/Windows

- PKI

Page 34: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

OAuth

• Have you heard about OAuth?

• Authentication patterns

- User login

- App login

• User login

- Allow ArcGIS Online users to authorize your application on their behalf

- Two steps process:

- authorization → authorization code

- exchange code for tokens → access token and refresh token

Page 35: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

OAuth

• Create an OAuthView in code or from xml

- portal url

- client id

- CallbackListener

• Get credentials from CallbackListener.onCallback

• Handle error in CallbackListener.onError()

• Customize the http authentication request dialog

Page 36: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps App

Page 37: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps App

● Material

○ Navigation Drawer

● Search Widget

● Floating Compass Button

● Fragments

○ Routing Dialog

○ Directions Dialog

○ Basemaps Dialog

Page 38: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Maps App on GitHub

● https://github.com/Esri/maps-app-android● Get involved● Report Issues● Contribute Code

○ Fork it○ Clone it

○ Configure remotes○ Send pull requests

Page 39: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

DEMOMaps App

Page 40: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Offline support

● Take a map offline○ View○ Edit○ Sync

●Perform offline tasks○ Analysis (Beta)○ Routing/Geocoding○ Query

Page 41: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Quartz

Page 42: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Map Decoupled from MapView

•Content and presentation are separated

•Map is now a separate class (model object)-Declare in code only

-Defines the data displayed by the MapView

-Contains content - layers, basemap, bookmarks

-Open an existing map or build in code, modify, save

MapView (view object)

Has a map set on it

Extends android.view.ViewGroup

Control visible area of Map using Viewpoints

GraphicsOverlay(s), LocationDisplay, …

Page 43: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Asynchronous methods

•10.2.x had sync & async methods-Result execute(Parameters params)-Future<Result> execute(Parameters params, CallbackListener<Result> callback)

•In Quartz it’s just one async method-ListenableFuture<Result> execute(Parameters params)

•Advantages:-Reduces API clutter-Promotes asynchronous programming-We think you prefer async methods (we take care of executing operations on background threads)

-Do you agree?

Page 44: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Vector Tile Layer

•Optimized data format-Small in size-Can be up to 1000 times smaller that Raster Tiles-Update to data takes minutes instead of days

•Because it vectors, it looks great on all devices-DPI of data not really an issue

•Dynamic labeling-Clearer, more readable text - On the fly labeling for heads up display

•Ability to style- Streets, Topographic, Canvas from one dataset- Day and Night mode

Page 45: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Mobile Map Package

•Consolidates maps or basemaps into a single file (.mmpk)•Use ArcGIS Pro 1.2 or later to create one•Easy and fast to share•Common uses

- Geocoding- Navigation

•Can be used in•Navigator for ArcGIS 2.0•Or any application built using ArcGIS Runtime (Quartz Beta 2)

Page 46: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

New Security Pattern

• AuthenticationManager

- Set AuthenticationChallengeHandler

- Manage in-memory credential cache

- Set server and client certificate

- Manage a set of OAuthConfiguration

• Default implementation of challenge handling- Token-based, HTTP/Windows, PKI

- Prompt for credentials or client certificates

- Trust self-signed certificate

- OAuth user login

- Greatly simplify authentication workflows

AuthenticationManager.setAuthenticationChallengeHandler(new D f ltA th ti ti Ch ll H dl (C t t))

Page 47: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

New Security Pattern

• No longer constructors taking Credential

• Testing with credentials- (Because you don’t hard code credentials into your apps

right?)

- RemoteResource has setCredential()- set before it is loaded

Page 48: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Quartz Demo

Page 49: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Agenda

• Introduction to the ArcGIS Android SDK• Maps & Layers• Basemaps (Portal)• Location• Place Search• Routing• Authentication• Maps App• Quartz

Page 50: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

Sessions to attendRelated to Runtime and/or Android

ArcGIS Runtime SDKs: Building Offline Apps

Room 31 A Wed: 10:15AM - 11:30AM

Designing a Great User Experience for Your ArcGIS Runtime Apps

Demo Theater 3 Wed: 1:30PM - 2:15PM

Optimizing your ArcGIS Runtime Apps for Performance

Demo Theater 3 Wed: 2:30PM - 3:15PM

Integrating ArcGIS Runtime with Devices and Sensors

Demo Theater 3 Wed: 4:30PM - 5:15PM

Road Ahead: ArcGIS Runtime SDKs Ballroom 06 E Thur: 3:15PM - 4:30PM

Page 51: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code

THANK YOU

QUESTIONS

Page 52: ArcGIS Runtime SDK for Android An Introduction...Map Decoupled from MapView •Content and presentation are separated •Map is now a separate class (model object)-Declare in code