SlideShare a Scribd company logo
1 of 23
Download to read offline
Copyright © 2013 CommonsWare, LLC
MapsV2...
AndYou!
AnDevCon Boston 2013
Copyright © 2013 CommonsWare, LLC
Maps: Not Invented in 2008!
● Android 1.0: Maps SDK Add-On
– Same as what Google Maps app used
– Creaky API, particularly with fragments
● The Fork
– Google Maps started using own engine
– Gained more features than old SDK add-on
supported
Copyright © 2013 CommonsWare, LLC
Maps: Not Invented In 2012 Either!
● MapsV2
– Introduced in late 2012
– New API, new device requirements, new features
● Close to full Google Maps app
● MapsV1: Deprecated!
– Can no longer official get MapsV1 API keys
– Still runs, if you have keys from before
Copyright © 2013 CommonsWare, LLC
Legal, Without Ease
● MapsV1 and MapsV2:Terms of Service
– Required to use these APIs
– Put restrictions on how you use those APIs
● Example: no real-time turn-by-turn navigation
– IANALNDIPOOTV
● Please have qualified legal counsel review these
terms if they concern you
Copyright © 2013 CommonsWare, LLC
Users Have Issues (No, Really!)
● Requirements
– Play Services Framework
● May already exist
● May be available from the Play Store
● Not available by other legitimate means
– OpenGL ES 2.0
● On 99.8% of devices with the Play Store
Copyright © 2013 CommonsWare, LLC
You Have IssuesToo
● No Emulator Support
– Play Services Framework not available in
emulator images
● Google has indicated this will be resolved...
sometime
– Various workarounds of dubious legality
documented on teh Interwebs
● Expectation:Test on Hardware
Copyright © 2013 CommonsWare, LLC
Preparation M
● Setting Up MapsV2 Development
– Download Google Play Services SDK from SDK
Manager (in Extras area)
– Result: Android Library Project
● Eclipse: import into workspace, then attach to
application project
● Command-line: android update project
● Other IDEs: ???
Copyright © 2013 CommonsWare, LLC
Yet More Preparation M
● MapsV2 API Key
– No, it's not the same as your MapsV1 API key
– Obtain it from the Google API Console
– Tied to your package name, signing key
● SHA-1 fingerprint vs. MD5
● Up to ~5 signing key/package name pairs per API key
Copyright © 2013 CommonsWare, LLC
Let's Get Mappy, People
● A MapsV2 Project
– ...does not need to use a Google APIs SDK as a
build target
– …does need to restrict to OpenGL ES 2.0 devices
● Or make optional, but test at runtime
– ...does need permissions, including a custom one
– ...does need a MapsV2 API key
Copyright © 2013 CommonsWare, LLC
Let's Get Mappy, People
● A MapsV2 Activity
– ...does not have to inherit from any magic
activity class
– ...does need to use MapFragment,
SupportMapFragment, or MapView
– ...does have a lot of legwork to ensure MapsV2 is
available, the user has access to license terms,
etc.
● ...all of which can be nicely abstracted away
Copyright © 2013 CommonsWare, LLC
Working (with a map) For a Living
● GoogleMap
– Your gateway to the actual mapping API
– Obtained from MapFragment,
SupportMapFragment, or MapView via
getMap()
– Most method calls result in IPC
● Comparatively slow
● Avoid doing lots of these in a tight loop
● Must be called on the main application thread
Copyright © 2013 CommonsWare, LLC
Showing Something Useful
● CameraUpdate
– Changes in characteristics of the “camera”
● Center, zoom, etc.
– Create using CameraUpdateFactory
– Apply to GoogleMap
● moveCamera()
● animateCamera()
Copyright © 2013 CommonsWare, LLC
Typing Up a Map
● Default MapType: MAP_TYPE_NORMAL
● Changing MapTypes
– Choose a type (e.g., MAP_TYPE_HYBRID)
– Call setMapType() on your GoogleMap
Copyright © 2013 CommonsWare, LLC
Marking Up a Map
● No More Overlays!
● Add MarkersVia addMarker()
– Takes a MarkerOptions object
– Fluent API to describe marker
– Position as a LatLng
● No more microdegrees!
– Provide title and snippet for default pop-up
“info window”
Copyright © 2013 CommonsWare, LLC
BYO Info
● Controlling the InfoWindows
– Implement InfoWindowAdapter interface
● getInfoContents(): your ownView to pour into
MapsV2-supplied frame
● getInfoWindow(): your ownView with your own
frame
– Associate with GoogleMap via
setInfoWindowAdapter()
Copyright © 2013 CommonsWare, LLC
Taps, Sans Bugle
● MarkerTaps
– Implement OnMarkerClickListener interface
● onMarkerClick() called when user taps on a
Marker
– Associate with GoogleMap via
setOnMarkerClickListener()
Copyright © 2013 CommonsWare, LLC
Markers Can Be a Real Drag
● Marker Drag-and-Drop
– Call draggable(true) on MarkerOptions
– Implement OnMarkerDragListener interface
● onMarkerDragStart()
● onMarkerDrag()
● onMarkerDragEnd()
– Associate with GoogleMap via
setOnMarkerDragListener()
Copyright © 2013 CommonsWare, LLC
WhereYou At?
● Enabling “My Location”
– setMyLocationEnabled(true) on
GoogleMap
● Adds “My Location” button
● Requires suitable permissions (e.g.,
ACCESS_FINE_LOCATION)
● When tapped, camera follows the user
– OnMyLocationChangeListener and
setOnMyLocationChangeListener()
Copyright © 2013 CommonsWare, LLC
Pages of Maps
● MapFragment andViewPager
– It just works!
● Problem:ViewPagerWants Gestures
– Default: cannot pan map horizontally
– Solution: CustomViewPager subclass, overriding
canScroll(), to indicate widgets that handle
their own scrolling
Copyright © 2013 CommonsWare, LLC
Dirty Details, Done Dirt Cheap
● AbstractMapActivity Features
– Determining if Play Services Framework is
available
– Leading user to install Play Services Framework
if possible
– Showing license terms
Copyright © 2013 CommonsWare, LLC
Other Fun Stuff
● Supplying own location data
● Polylines, polygons, and circles
● Controlling default gestures
● TileOverlay and GroundOverlay
– Images displayed on top of map tiles
● ...and more!
Copyright © 2013 CommonsWare, LLC
Do Worry, Be Mappy
● Problems and Issues
– Reported leaks in configuration changes
– GLSurfaceView, animations, and black bars
– Play Services Framework detection buggy
– IPC and performance
– OpenGL ES 2.0 requirement
Copyright © 2013 CommonsWare, LLC
Speaker Contact
Information
Source Code

More Related Content

What's hot

Android Modularization
Android ModularizationAndroid Modularization
Android ModularizationYoung-Hyuk Yoo
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopOpersys inc.
 
Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced RoutingLaurent Duveau
 
Qt Technical Presentation
Qt Technical PresentationQt Technical Presentation
Qt Technical PresentationDaniel Rocha
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsCommonsWare
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowOpersys inc.
 
Building the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With YouBuilding the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With YouNabayan Roy
 
GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)firenze-gtug
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGLGlobant
 

What's hot (10)

Android Modularization
Android ModularizationAndroid Modularization
Android Modularization
 
Embedded Android Workshop with Lollipop
Embedded Android Workshop with LollipopEmbedded Android Workshop with Lollipop
Embedded Android Workshop with Lollipop
 
Angular
AngularAngular
Angular
 
Angular Advanced Routing
Angular Advanced RoutingAngular Advanced Routing
Angular Advanced Routing
 
Qt Technical Presentation
Qt Technical PresentationQt Technical Presentation
Qt Technical Presentation
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable Apps
 
Embedded Android Workshop with Marshmallow
Embedded Android Workshop with MarshmallowEmbedded Android Workshop with Marshmallow
Embedded Android Workshop with Marshmallow
 
Building the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With YouBuilding the Developer Experience Right - May The Force of API Be With You
Building the Developer Experience Right - May The Force of API Be With You
 
GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)GWT - AppDays - (25 aprile 2014, pordenone)
GWT - AppDays - (25 aprile 2014, pordenone)
 
3D Programming Basics: WebGL
3D Programming Basics: WebGL3D Programming Basics: WebGL
3D Programming Basics: WebGL
 

Viewers also liked

Study of the Source code of Google's Android App mytracks
Study of the Source code of Google's  Android App mytracks Study of the Source code of Google's  Android App mytracks
Study of the Source code of Google's Android App mytracks Mike Yen
 
Panduan Instalasi Android Studio
Panduan Instalasi Android StudioPanduan Instalasi Android Studio
Panduan Instalasi Android StudioAgus Haryanto
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in BackgroundAhsanul Karim
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedAhsanul Karim
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsAhsanul Karim
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIAhsanul Karim
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Ahsanul Karim
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIAhsanul Karim
 
Belajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan VolleyBelajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan VolleyAgus Haryanto
 
Android Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAndroid Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAgus Haryanto
 
Belajar Android Studio CRUD Data Mahasiswa
Belajar Android Studio CRUD Data MahasiswaBelajar Android Studio CRUD Data Mahasiswa
Belajar Android Studio CRUD Data MahasiswaAgus Haryanto
 
Belajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog ProdukBelajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog ProdukAgus Haryanto
 
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLite
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLiteCara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLite
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLitecreatorb dev
 
Belajar Android Studio - Membuat Aplikasi Android Sederhana
Belajar Android Studio - Membuat Aplikasi Android SederhanaBelajar Android Studio - Membuat Aplikasi Android Sederhana
Belajar Android Studio - Membuat Aplikasi Android SederhanaAgus Haryanto
 
Tutorial Lengkap Cara Membuat Aplikasi Android Sederhana
Tutorial Lengkap Cara Membuat Aplikasi Android SederhanaTutorial Lengkap Cara Membuat Aplikasi Android Sederhana
Tutorial Lengkap Cara Membuat Aplikasi Android Sederhanacreatorb dev
 

Viewers also liked (17)

Cara Daftar Google Map
Cara Daftar Google MapCara Daftar Google Map
Cara Daftar Google Map
 
Study of the Source code of Google's Android App mytracks
Study of the Source code of Google's  Android App mytracks Study of the Source code of Google's  Android App mytracks
Study of the Source code of Google's Android App mytracks
 
Android google mapv2
Android google mapv2Android google mapv2
Android google mapv2
 
Panduan Instalasi Android Studio
Panduan Instalasi Android StudioPanduan Instalasi Android Studio
Panduan Instalasi Android Studio
 
Day 15: Working in Background
Day 15: Working in BackgroundDay 15: Working in Background
Day 15: Working in Background
 
Day 1 Android: Before Getting Started
Day 1 Android: Before Getting StartedDay 1 Android: Before Getting Started
Day 1 Android: Before Getting Started
 
Day 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViewsDay 8: Dealing with Lists and ListViews
Day 8: Dealing with Lists and ListViews
 
Day 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts APIDay 15: Content Provider: Using Contacts API
Day 15: Content Provider: Using Contacts API
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Day 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location APIDay 9: Make Your App Location Aware using Location API
Day 9: Make Your App Location Aware using Location API
 
Belajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan VolleyBelajar Android PHP MySQL Login dengan Volley
Belajar Android PHP MySQL Login dengan Volley
 
Android Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySqlAndroid Fast Track CRUD Android PHP MySql
Android Fast Track CRUD Android PHP MySql
 
Belajar Android Studio CRUD Data Mahasiswa
Belajar Android Studio CRUD Data MahasiswaBelajar Android Studio CRUD Data Mahasiswa
Belajar Android Studio CRUD Data Mahasiswa
 
Belajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog ProdukBelajar Android Membuat Katalog Produk
Belajar Android Membuat Katalog Produk
 
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLite
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLiteCara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLite
Cara Membuat Aplikasi Android Resep Masakan Sederhana Android-SQLite
 
Belajar Android Studio - Membuat Aplikasi Android Sederhana
Belajar Android Studio - Membuat Aplikasi Android SederhanaBelajar Android Studio - Membuat Aplikasi Android Sederhana
Belajar Android Studio - Membuat Aplikasi Android Sederhana
 
Tutorial Lengkap Cara Membuat Aplikasi Android Sederhana
Tutorial Lengkap Cara Membuat Aplikasi Android SederhanaTutorial Lengkap Cara Membuat Aplikasi Android Sederhana
Tutorial Lengkap Cara Membuat Aplikasi Android Sederhana
 

Similar to Maps V2... And You!

sdc-2016-gvrf-and-io_public
sdc-2016-gvrf-and-io_publicsdc-2016-gvrf-and-io_public
sdc-2016-gvrf-and-io_publicRick Lau
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackSunita Singh
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android DevelopmentHayi Nukman
 
Philipp Nagele (Wikitude) Wikitude SDK Tutorial
Philipp Nagele (Wikitude) Wikitude SDK Tutorial Philipp Nagele (Wikitude) Wikitude SDK Tutorial
Philipp Nagele (Wikitude) Wikitude SDK Tutorial AugmentedWorldExpo
 
Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009sullis
 
Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009sullis
 
[English] Create Mobile LBS Application Using Maps API
[English] Create Mobile LBS Application Using Maps API[English] Create Mobile LBS Application Using Maps API
[English] Create Mobile LBS Application Using Maps APIGoogle Cloud Platform - Japan
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a NutshellAleix Solé
 
PT GTUG 1st Technical Tession - Android
PT GTUG 1st Technical Tession - AndroidPT GTUG 1st Technical Tession - Android
PT GTUG 1st Technical Tession - Androiddrjuniornet
 
App integration: Strategies and Tactics
App integration: Strategies and TacticsApp integration: Strategies and Tactics
App integration: Strategies and TacticsCommonsWare
 
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portlandsullis
 
App Integration (Revised and Updated)
App Integration (Revised and Updated)App Integration (Revised and Updated)
App Integration (Revised and Updated)CommonsWare
 
Cross Platform Mobile App Development
Cross Platform Mobile App DevelopmentCross Platform Mobile App Development
Cross Platform Mobile App DevelopmentAnnmarie Lanesey
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Natalia Efimtseva
 
Android Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewAndroid Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewCommonsWare
 
Latest & interesting updates #android dev
Latest & interesting updates #android devLatest & interesting updates #android dev
Latest & interesting updates #android devParesh Mayani
 
Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3Bruce Pentreath
 
Philipp Nagele (Wikitude): What's Next with Wikitude
Philipp Nagele (Wikitude): What's Next with WikitudePhilipp Nagele (Wikitude): What's Next with Wikitude
Philipp Nagele (Wikitude): What's Next with WikitudeAugmentedWorldExpo
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Tomáš Kypta
 

Similar to Maps V2... And You! (20)

sdc-2016-gvrf-and-io_public
sdc-2016-gvrf-and-io_publicsdc-2016-gvrf-and-io_public
sdc-2016-gvrf-and-io_public
 
Google I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and JetpackGoogle I/O 2019 - what's new in Android Q and Jetpack
Google I/O 2019 - what's new in Android Q and Jetpack
 
Begining Android Development
Begining Android DevelopmentBegining Android Development
Begining Android Development
 
Philipp Nagele (Wikitude) Wikitude SDK Tutorial
Philipp Nagele (Wikitude) Wikitude SDK Tutorial Philipp Nagele (Wikitude) Wikitude SDK Tutorial
Philipp Nagele (Wikitude) Wikitude SDK Tutorial
 
Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009Introduction to Android - Mobile Fest Singapore 2009
Introduction to Android - Mobile Fest Singapore 2009
 
Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009Getting Started with Android - OSSPAC 2009
Getting Started with Android - OSSPAC 2009
 
[English] Create Mobile LBS Application Using Maps API
[English] Create Mobile LBS Application Using Maps API[English] Create Mobile LBS Application Using Maps API
[English] Create Mobile LBS Application Using Maps API
 
Android Development in a Nutshell
Android Development in a NutshellAndroid Development in a Nutshell
Android Development in a Nutshell
 
PT GTUG 1st Technical Tession - Android
PT GTUG 1st Technical Tession - AndroidPT GTUG 1st Technical Tession - Android
PT GTUG 1st Technical Tession - Android
 
App integration: Strategies and Tactics
App integration: Strategies and TacticsApp integration: Strategies and Tactics
App integration: Strategies and Tactics
 
Introduction to Android - Mobile Portland
Introduction to Android - Mobile PortlandIntroduction to Android - Mobile Portland
Introduction to Android - Mobile Portland
 
App Integration (Revised and Updated)
App Integration (Revised and Updated)App Integration (Revised and Updated)
App Integration (Revised and Updated)
 
Cross Platform Mobile App Development
Cross Platform Mobile App DevelopmentCross Platform Mobile App Development
Cross Platform Mobile App Development
 
Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)Mobile backends with Google Cloud Platform (MBLTDev'14)
Mobile backends with Google Cloud Platform (MBLTDev'14)
 
Android Development...The 20,000-Foot View
Android Development...The 20,000-Foot ViewAndroid Development...The 20,000-Foot View
Android Development...The 20,000-Foot View
 
Latest & interesting updates #android dev
Latest & interesting updates #android devLatest & interesting updates #android dev
Latest & interesting updates #android dev
 
Map
MapMap
Map
 
Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3Angular JS 2_0 BCS CTO_in_Res V3
Angular JS 2_0 BCS CTO_in_Res V3
 
Philipp Nagele (Wikitude): What's Next with Wikitude
Philipp Nagele (Wikitude): What's Next with WikitudePhilipp Nagele (Wikitude): What's Next with Wikitude
Philipp Nagele (Wikitude): What's Next with Wikitude
 
Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012Android development - the basics, MFF UK, 2012
Android development - the basics, MFF UK, 2012
 

More from CommonsWare

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsCommonsWare
 
Getting Android Developers for Your Wearables
Getting Android Developers for Your WearablesGetting Android Developers for Your Wearables
Getting Android Developers for Your WearablesCommonsWare
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to BackCommonsWare
 
Android Security: Defending Your Users
Android Security: Defending Your UsersAndroid Security: Defending Your Users
Android Security: Defending Your UsersCommonsWare
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerCommonsWare
 
Not Quite As Painful Threading
Not Quite As Painful ThreadingNot Quite As Painful Threading
Not Quite As Painful ThreadingCommonsWare
 
Android Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewAndroid Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewCommonsWare
 
A Deep Dive Into ViewPager
A Deep Dive Into ViewPagerA Deep Dive Into ViewPager
A Deep Dive Into ViewPagerCommonsWare
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2CommonsWare
 
Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web AppsCommonsWare
 
From Android to the Mobile Web
From Android to the Mobile WebFrom Android to the Mobile Web
From Android to the Mobile WebCommonsWare
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of WearablesCommonsWare
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipherCommonsWare
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFCCommonsWare
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly BeanCommonsWare
 
Making Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsMaking Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsCommonsWare
 
AppsWorld Keynote
AppsWorld KeynoteAppsWorld Keynote
AppsWorld KeynoteCommonsWare
 
Rich Text Editing and Beyond
Rich Text Editing and BeyondRich Text Editing and Beyond
Rich Text Editing and BeyondCommonsWare
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsCommonsWare
 

More from CommonsWare (20)

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable Projects
 
Getting Android Developers for Your Wearables
Getting Android Developers for Your WearablesGetting Android Developers for Your Wearables
Getting Android Developers for Your Wearables
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to Back
 
Android Security: Defending Your Users
Android Security: Defending Your UsersAndroid Security: Defending Your Users
Android Security: Defending Your Users
 
Secondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManagerSecondary Screen Support Using DisplayManager
Secondary Screen Support Using DisplayManager
 
Not Quite As Painful Threading
Not Quite As Painful ThreadingNot Quite As Painful Threading
Not Quite As Painful Threading
 
Android Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewAndroid Development: The 20,000-Foot View
Android Development: The 20,000-Foot View
 
A Deep Dive Into ViewPager
A Deep Dive Into ViewPagerA Deep Dive Into ViewPager
A Deep Dive Into ViewPager
 
Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2Second-Screen Support in Android 4.2
Second-Screen Support in Android 4.2
 
Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web Apps
 
From Android to the Mobile Web
From Android to the Mobile WebFrom Android to the Mobile Web
From Android to the Mobile Web
 
X Means Y
X Means YX Means Y
X Means Y
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of Wearables
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipher
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFC
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly Bean
 
Making Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsMaking Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business Models
 
AppsWorld Keynote
AppsWorld KeynoteAppsWorld Keynote
AppsWorld Keynote
 
Rich Text Editing and Beyond
Rich Text Editing and BeyondRich Text Editing and Beyond
Rich Text Editing and Beyond
 
Backwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and TacticsBackwards Compatibility: Strategies and Tactics
Backwards Compatibility: Strategies and Tactics
 

Recently uploaded

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 

Recently uploaded (20)

Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 

Maps V2... And You!

  • 1. Copyright © 2013 CommonsWare, LLC MapsV2... AndYou! AnDevCon Boston 2013
  • 2. Copyright © 2013 CommonsWare, LLC Maps: Not Invented in 2008! ● Android 1.0: Maps SDK Add-On – Same as what Google Maps app used – Creaky API, particularly with fragments ● The Fork – Google Maps started using own engine – Gained more features than old SDK add-on supported
  • 3. Copyright © 2013 CommonsWare, LLC Maps: Not Invented In 2012 Either! ● MapsV2 – Introduced in late 2012 – New API, new device requirements, new features ● Close to full Google Maps app ● MapsV1: Deprecated! – Can no longer official get MapsV1 API keys – Still runs, if you have keys from before
  • 4. Copyright © 2013 CommonsWare, LLC Legal, Without Ease ● MapsV1 and MapsV2:Terms of Service – Required to use these APIs – Put restrictions on how you use those APIs ● Example: no real-time turn-by-turn navigation – IANALNDIPOOTV ● Please have qualified legal counsel review these terms if they concern you
  • 5. Copyright © 2013 CommonsWare, LLC Users Have Issues (No, Really!) ● Requirements – Play Services Framework ● May already exist ● May be available from the Play Store ● Not available by other legitimate means – OpenGL ES 2.0 ● On 99.8% of devices with the Play Store
  • 6. Copyright © 2013 CommonsWare, LLC You Have IssuesToo ● No Emulator Support – Play Services Framework not available in emulator images ● Google has indicated this will be resolved... sometime – Various workarounds of dubious legality documented on teh Interwebs ● Expectation:Test on Hardware
  • 7. Copyright © 2013 CommonsWare, LLC Preparation M ● Setting Up MapsV2 Development – Download Google Play Services SDK from SDK Manager (in Extras area) – Result: Android Library Project ● Eclipse: import into workspace, then attach to application project ● Command-line: android update project ● Other IDEs: ???
  • 8. Copyright © 2013 CommonsWare, LLC Yet More Preparation M ● MapsV2 API Key – No, it's not the same as your MapsV1 API key – Obtain it from the Google API Console – Tied to your package name, signing key ● SHA-1 fingerprint vs. MD5 ● Up to ~5 signing key/package name pairs per API key
  • 9. Copyright © 2013 CommonsWare, LLC Let's Get Mappy, People ● A MapsV2 Project – ...does not need to use a Google APIs SDK as a build target – …does need to restrict to OpenGL ES 2.0 devices ● Or make optional, but test at runtime – ...does need permissions, including a custom one – ...does need a MapsV2 API key
  • 10. Copyright © 2013 CommonsWare, LLC Let's Get Mappy, People ● A MapsV2 Activity – ...does not have to inherit from any magic activity class – ...does need to use MapFragment, SupportMapFragment, or MapView – ...does have a lot of legwork to ensure MapsV2 is available, the user has access to license terms, etc. ● ...all of which can be nicely abstracted away
  • 11. Copyright © 2013 CommonsWare, LLC Working (with a map) For a Living ● GoogleMap – Your gateway to the actual mapping API – Obtained from MapFragment, SupportMapFragment, or MapView via getMap() – Most method calls result in IPC ● Comparatively slow ● Avoid doing lots of these in a tight loop ● Must be called on the main application thread
  • 12. Copyright © 2013 CommonsWare, LLC Showing Something Useful ● CameraUpdate – Changes in characteristics of the “camera” ● Center, zoom, etc. – Create using CameraUpdateFactory – Apply to GoogleMap ● moveCamera() ● animateCamera()
  • 13. Copyright © 2013 CommonsWare, LLC Typing Up a Map ● Default MapType: MAP_TYPE_NORMAL ● Changing MapTypes – Choose a type (e.g., MAP_TYPE_HYBRID) – Call setMapType() on your GoogleMap
  • 14. Copyright © 2013 CommonsWare, LLC Marking Up a Map ● No More Overlays! ● Add MarkersVia addMarker() – Takes a MarkerOptions object – Fluent API to describe marker – Position as a LatLng ● No more microdegrees! – Provide title and snippet for default pop-up “info window”
  • 15. Copyright © 2013 CommonsWare, LLC BYO Info ● Controlling the InfoWindows – Implement InfoWindowAdapter interface ● getInfoContents(): your ownView to pour into MapsV2-supplied frame ● getInfoWindow(): your ownView with your own frame – Associate with GoogleMap via setInfoWindowAdapter()
  • 16. Copyright © 2013 CommonsWare, LLC Taps, Sans Bugle ● MarkerTaps – Implement OnMarkerClickListener interface ● onMarkerClick() called when user taps on a Marker – Associate with GoogleMap via setOnMarkerClickListener()
  • 17. Copyright © 2013 CommonsWare, LLC Markers Can Be a Real Drag ● Marker Drag-and-Drop – Call draggable(true) on MarkerOptions – Implement OnMarkerDragListener interface ● onMarkerDragStart() ● onMarkerDrag() ● onMarkerDragEnd() – Associate with GoogleMap via setOnMarkerDragListener()
  • 18. Copyright © 2013 CommonsWare, LLC WhereYou At? ● Enabling “My Location” – setMyLocationEnabled(true) on GoogleMap ● Adds “My Location” button ● Requires suitable permissions (e.g., ACCESS_FINE_LOCATION) ● When tapped, camera follows the user – OnMyLocationChangeListener and setOnMyLocationChangeListener()
  • 19. Copyright © 2013 CommonsWare, LLC Pages of Maps ● MapFragment andViewPager – It just works! ● Problem:ViewPagerWants Gestures – Default: cannot pan map horizontally – Solution: CustomViewPager subclass, overriding canScroll(), to indicate widgets that handle their own scrolling
  • 20. Copyright © 2013 CommonsWare, LLC Dirty Details, Done Dirt Cheap ● AbstractMapActivity Features – Determining if Play Services Framework is available – Leading user to install Play Services Framework if possible – Showing license terms
  • 21. Copyright © 2013 CommonsWare, LLC Other Fun Stuff ● Supplying own location data ● Polylines, polygons, and circles ● Controlling default gestures ● TileOverlay and GroundOverlay – Images displayed on top of map tiles ● ...and more!
  • 22. Copyright © 2013 CommonsWare, LLC Do Worry, Be Mappy ● Problems and Issues – Reported leaks in configuration changes – GLSurfaceView, animations, and black bars – Play Services Framework detection buggy – IPC and performance – OpenGL ES 2.0 requirement
  • 23. Copyright © 2013 CommonsWare, LLC Speaker Contact Information Source Code