Open main menu

CDOT Wiki β

Changes

MAP524/DPS924 Lecture 9

546 bytes added, 23:08, 5 August 2015
Using Google Maps
== Using Google Maps ==
 
=== Obtain API Access ===
There are many guides [https://developers.google.com/maps/documentation/android/intro here].
** In Credentials/Public API access add a new Android key.
** I had to wait a minute for it to show up.
* [https://developers.google.com/maps/documentation/android/signup#add_the_api_key_to_your_application Add that key] to your app.=== Code === 
* If you haven't already done it - follow the "Setup to use Google Play Services" section above.
* [https://developers.google.com/maps/documentation/android/signup#add_the_api_key_to_your_application Add the API key] to your app.
* The rest of the code you can find in parts of [https://developers.google.com/maps/documentation/android/map this tutorial], specifically to get the minimum going you'll need to:
** Add the appropriate fragment XML code to your activity layout and position it so that it doesn't cover other elements in your activity.
** Make your activity implement FragmentActivity.
** Use getMapAsync() to set up your activity to be the callback for when the map loads.
** Do something interesting in onMapReady()