using location and google maps v2 in android apps

22
Using Google Maps V2 in Android Presented By Joseph Kandi Email: [email protected] http://www.peruzal.co.za Saturday 14 September 13

Upload: joseph-kandi

Post on 19-May-2015

6.409 views

Category:

Technology


14 download

DESCRIPTION

The slides were presented as part of the Cape Town Android App Development training on how to use the Google Maps v2 in Android Apps with Android Studio.

TRANSCRIPT

Page 1: Using Location and Google Maps v2 in Android Apps

Using Google Maps V2 in Android

Presented By Joseph KandiEmail: [email protected]://www.peruzal.co.za

Saturday 14 September 13

Page 2: Using Location and Google Maps v2 in Android Apps

Take AwaysCreate A New Project in Android Studio

Use SDK Manager to Download Required APIs

Add Google Play Services to Project

Add the MapFragment

Get the Android API Key

Add Required Permissions to AndroidManifest.xml file

Manipulate the Map Programmatically

Add Markers to the Map

Saturday 14 September 13

Page 3: Using Location and Google Maps v2 in Android Apps

Create A New Project

Note: We are using the Google APIs

We will need the Package name later

Saturday 14 September 13

Page 4: Using Location and Google Maps v2 in Android Apps

Blank Activity

We want a blank project

Saturday 14 September 13

Page 5: Using Location and Google Maps v2 in Android Apps

Change Activity Name

Change the Activity Name

Change the layout xml file name as well

Saturday 14 September 13

Page 6: Using Location and Google Maps v2 in Android Apps

Download Required APIs

Launch SDK Manager

Install Google APIs

Install Google Repository

Install Google Play Services

Saturday 14 September 13

Page 7: Using Location and Google Maps v2 in Android Apps

Install Required APIs

Install Google APIs

Install Support Repository

Install Google Play Services

Install Google Repository

Saturday 14 September 13

Page 8: Using Location and Google Maps v2 in Android Apps

Add Google Play Services

Add the Google Play Services dependency to gradle.build file

Gradle configuration file

Saturday 14 September 13

Page 9: Using Location and Google Maps v2 in Android Apps

Getting the API Key

Sign Up on Google API Console

Create a New Project

Enable Google Android Maps V2

Use the keytool to get the SHA1 signing keys

Get the API key from Google API Console

Saturday 14 September 13

Page 10: Using Location and Google Maps v2 in Android Apps

Add MapFragment

Add the Google Maps Fragment

Add fragment

Saturday 14 September 13

Page 11: Using Location and Google Maps v2 in Android Apps

Declare Options for the MapFragment

Add Schema to be able to add map options

Add map options

Saturday 14 September 13

Page 12: Using Location and Google Maps v2 in Android Apps

Create New Android Key

Create a new Android key

Enable Google Maps Android V2 under Services

Paste SHA1 key fingerprint here, follow the example below

Saturday 14 September 13

Page 13: Using Location and Google Maps v2 in Android Apps

Get SHA1 Hash with keytool

Change directory to the .android folder, its under the Users\user folder

Saturday 14 September 13

Page 14: Using Location and Google Maps v2 in Android Apps

Troubleshoot if errors

The command might not be in the PATH

Saturday 14 September 13

Page 15: Using Location and Google Maps v2 in Android Apps

Fix “Command Not Found”

Locate the keytool command, it’s installed the in JDK bin folder

Saturday 14 September 13

Page 16: Using Location and Google Maps v2 in Android Apps

Modify PATH environment variable

Edit the PATH environment variable and add the the location to the JDK bin folder

Choose PATH

Choose Edit

Saturday 14 September 13

Page 17: Using Location and Google Maps v2 in Android Apps

Re-run keytool commandkeytool command working now

Execute command to retrieve the SHA1 fingerprint

Saturday 14 September 13

Page 18: Using Location and Google Maps v2 in Android Apps

Get SHA1 Hash

Copy SHA1 fingerprint

Saturday 14 September 13

Page 19: Using Location and Google Maps v2 in Android Apps

Complete Setup on Google API Console

Paste the fingerprint

Saturday 14 September 13

Page 20: Using Location and Google Maps v2 in Android Apps

Copy API Key

Get the API Key

Saturday 14 September 13

Page 21: Using Location and Google Maps v2 in Android Apps

Add Required Permissions to AndroidManifest.xml

Add the Key to the manifest file

Add permissionsRequire OpenGL ES v2

Saturday 14 September 13

Page 22: Using Location and Google Maps v2 in Android Apps

ENDShameless marketing : For more on Android Training

visit us at

http://www.peruzal.co.za

Saturday 14 September 13