ArcGIS Runtime SDK for Android : Building Apps Rama Chintapalli Xueming Wu 2018 Esri DEVSummit Conference | Palm Springs, CA
ArcGIS Runtime SDK for Android : Building Apps
Rama Chintapalli
Xueming Wu
2018 Esri DEVSummit Conference | Palm Springs, CA
Agenda
➢Introduction
➢Developer Patterns
➢Functional Overview of SDK
➢SDK Components through Apps
➢Latest/New SDK Features
Building ArcGIS Android Apps
ArcGIS Navigator ArcGIS Collector ArcGIS Explorer
Getting Started with SDKSetup Guide
➢ Sign up for free ArcGIS Developers account
○ 50 credits a month, premium content,
○ register apps
https://developers.arcgis.com/sign-up
➢ Install Android Studio IDE
https://developer.android.com/studio
➢ Get Runtime Android SDK
○ Add dependencies in Gradle (or)
○ Download the SDK locally
https://developers.arcgis.com/android/latest/guide/install-and-set-up.htm
Gradle: Adding Runtime SDK Dependency
➢ Available from a Maven Repository hosted on Bintray
➢ Add Maven Repository to Project build.gradle
repositories {
maven { url 'https://esri.bintray.com/arcgis' }
}
➢ Add SDK dependency in App Module build.gradle
dependencies {
compile 'com.esri.arcgisruntime:arcgis-android:100.2.1'
}
Build Your First Map AppAdd Mapview to Layout
app > res > layout >activity_main.xml
Build Your First Map AppSet Map to MapView
SDK Resources
➢ Developers site - http://developers.arcgis.com/android
○ Guide Doc
○ API Reference
○ Samples Details
➢ GitHub
○ Samples Code
http://github.com/Esri/arcgis-runtime-samples-android
○ Example Apps
https://developers.arcgis.com/example-apps/
○ You can contribute
➢ GeoNet Community
http://geonet.esri.com/community/developers/
Example Apps
Maps App Ecological Marine Unit Nearby Your App!
Your App Here!
Xueming
Developer Patterns
Loadable pattern
➢A pattern of loading resources metadata asynchronously
○ Layers, Maps, Portal, Geodatabase, FeatureTable, Tasks etc
○ Remote services, disk I/O, or data processing
➢Formalizes and enhances the behaviors
➢Referred as “loadable”
➢Provides a generic API across different types of classes
➢Implements “Loadable” interface
Loadable pattern
➢Loadable is async
○ LoadStatus
○ LoadError
○ Can retry or cancel loading
○ Listeners
○ Supports chaining of loading
Loadable pattern
➢loadAsync()
➢getLoadStatus()
○ Not_LOADED
○ LOADING
○ LOADED
○ FAIL_TO_LOAD
➢getLoadError()
➢addDoneLoadingListener()
ListenableFuture pattern
➢Asynchronous methods use ListenableFuture
○ A promise to return a result
○ Add done listener, or call get (blocking)
➢Simplify asynchronous programming
○ Executes operations on background threads
○ Standard pattern for errors
ListenableFuture pattern
➢Future is a proxy or wrapper
around an object that is not there
yet
➢geocodeFuture
○ Returns future GeocodeResult
○ The promise that a GeocodeResult
will be available in the future
○ Retrieve it with geocodeFuture.get()
ListenableList pattern
➢Bind to data
➢Listener to know when content changes
➢Implemented on
○ GraphicsOverlay.getGraphics()
○ LayerList (getOperationalLayers(), getBaseLayers())
○ SublayerList
○ BookmarkList
○ Surface.ElevationSourceList
○ DistanceCompositeSceneSymbol.RangeCollection
ListenableList pattern
➢Add Graphic to GraphicsOverlay
Rama
Functional Overview - SDK
Functional Overview of SDKView Components
SceneViewMapView
GeoView
ArcGISMap ArcGISScene
GraphicsOverlay
Grid (MapView)
AttributionText
Callout
LocationDisplay
Magnifier
SketchEditor
ViewGroup
(android)
Functional Overview of SDK ...Model (Map/Scene) Components and their Source
FeatureLayer
ArcGISMap
ArcGISScene
Layers /
Tables
ArcGISTiledLayer
ArcGISVectorTiledLayer
ArcGISMapImageLayer
RasterLayer
WebTiledLayer
MobileMapPackage
(Local)
Webmap
(Service)
WebScene
(Service) WMSLayer
WMTSLayer
BingMapsLayer
ENCLayer
OpenSteetMapLayer
ServiceFeatureTable
GeodatabaseFeatureTable
ShapefileFeatureTable
GeoPackageFeatureTable
ArcGISSceneLayerArcGIS Pro/Desktop
ArcGIS Online ArcGIS Entreprise OGC/ Third Party
Functional Overview of SDK ...Tasks & Other Components
Map
Scene
Layer
LocatorTask
(Geocode)
RouteTask
(Network Analysis)
GeodatabaseSyncTask
(Geodatabase)
OfflineMapTask
OfflineMapSyncTask
ExportTileCacheTask
ExportVectorTileCacheTask
GeoprocessingTask
Portal
Security
Geometry
Symbols
SDK Components
Demo
Maps Apphttps://github.com/Esri/maps-app-android
Maps AppSDK Features
➢Map/MapView
➢Portal & Authentication - OAuth
➢Please search
○ Place suggestion
○ Geocoding
○ Reverse Geocoding
➢Routing
➢Graphic & GraphicsOverlay
Map/MapView
➢Content and presentation are separated
➢ArcGISMap defines content
○ Composed of basemap and operational layers
○ Loadable
○ Listeners - DoneLoading, LoadStatusChanged, BasemapChanged
○ Can be persisted as a webmap
➢MapView renders map content
○ Extends GeoView (android.view.ViewGroup)
○ Control visible extent of map using Viewpoint
○ Control Magnifier, SketchEditor, ViewInset, WrapAoundMode
○ Listeners
■ DrawStatusChanged, LayerViewStateChanged, and etc
■ MapRotationChanged, MapScaleChanged
Layer
➢Visualize, analyse, query, edit data
➢Renderer, visibility and order can be controlled
➢Loadable
➢LayerContent - Sublayers, LegendInfo
➢Common properties
○ Attribution
○ Description
○ FullExtent
○ Min/MaxScale
○ Name
○ Opacity
○ SpatialReference
Authentication
➢AuthenticationManager
○ Manages user authentication for secured resources
○ Central place for
■ Setting an authentication challenge handler
■ Manage in-memory credential cache
■ Manage OAuth Configurations
■ Manage client/server certificates
➢DefaultAuthenticationChallengeHandler
○ UX for challenge
○ Credentials (http, token-based, client certificate)
○ Self-signed server certificate
DefaultAuthenticationChallengeHandler
AuthenticationManager.setAuthenticationChallengeHanderl(
new DefaultAuthenticationChallengeHandler(context));
OAuth 2.0
➢DefaultAuthenticationChallengeHandler
○ Create OAuthConfiguration
○ Add to AuthenticationManager
○ Configure DefaultOauthIntentReceiver in manifest file
➢OAuthLoginManager
➢Support social login
Portal API
➢A developer’s gateway to the portal information model
➢High-level, coarse-grained APIs to access, use, create, and share content
➢Key classes
○ Portal
○ PortalUser
○ PortalItem
○ PortalGroup
Portal Workflows
➢Access basemaps of a portal
➢Access user’s content and groups
Geocoding API
➢LocatorTask
○ Loadable
○ ListenableFuture
➢GeocodeParameters
➢GeocodeResult
○ List
■ DisplayLocation
■ Label
■ Score
■ Attributes
Routing API
➢RouteTask
○ Loadable
○ ListenableFuture
➢RouteParameters
○ Get/Add stops
➢solveAsync
○ RouteResult - List
■ Routes
■ Messages
■ Barriers
Demo
Mobile Data Collector( Available Soon )
Mobile Data Collector AppSDK Features
➢Identify
➢Reverse Geocode
➢Portal Authentication - OAuth
➢Editing ○ Connected
○ Disconnected
○ Related Tables
➢OfflineMapTask○ Take Map Offline
Identify
Mobile Data Collector App
➢ Perform on MapView
➢ Can identify single/multiple layers
Editing
Mobile Data Collector App
➢ Connected
○ ServiceFeatureTable
○ ApplyEdits
➢ Disconnected
○ GeodatabaseFeatureTable
➢ ArcGISFeatureTable is the Base Class
➢ Related Features
○ Query methods on ArcGISFeatureTable
OfflineMapTask & OfflineMapSyncTask
Mobile Data Collector App
➢OfflineMapTask
○ Tiled Layer should have Export Tiles enabled
○ Feature Layer should have sync enabled
○ Methods to generate offline map
■ Also supports Preplanned Workflows
➢OfflineMapSyncTask
○ Synchronize Offline Map
➢Generated Offline Map is a MobileMapPackage
Demo
Viewshed Locationhttps://github.com/Esri/arcgis-runtime-
samples-android/tree/master/java/viewshed-
location
Viewshed Location sampleSDK Features
➢Scene/ScenView
➢ArcGISSceneLayer
➢ArcGISTiledElevationSource
➢AnalysisOverlay
➢Viewshed
➢LocationViewshed
Scene/SceneView
➢Content and presentation are separated
➢ArcGISScene defines content
○ Composed of basemap and operational layers
○ ArcGISSceneLayer - 3D features
○ Surface layers - elevation information
○ Loadable
➢SceneView renders scene data
○ Extends GeoView (android.view.ViewGroup)
○ Navigate scene using Camera
○ AnalysisOverlay - dynamic visualization of analysis result
Scene/SceneView
Analysis and AnalysisOverlay
➢Analysis defines analyses
○ LightOfSight, Viewshed and more to come
○ Can be added to AnalysisOverlay
➢AnalysisOverlayer visualize analyses
○ Control visibilities of Analysis
What’s New
➢OGC○ GeoPackages
○ WMSLayer
➢3D○ Analysis
■ Line Of Sight
■ Viewshed
➢Shapefile
➢ENC Layer
➢Geodatabase○ Transactional Editing
➢OfflineMap○ Preplanned Workflows
➢MobileMapPackages○ Raster Datasets
○ Tile Packages
Agenda
➢Introduction
➢Developer Patterns
➢Functional Overview of SDK
➢SDK Components through Apps
➢Latest/New SDK Features
Thank You
Please take our survey on the Esri Events App!