Lecture 13 Mobile Programming Google Maps Android API.

Slides:



Advertisements
Similar presentations
Android Application Development Tutorial. Topics Lecture 4 Overview Overview of Sensors Programming Tutorial 1: Tracking location with GPS and Google.
Advertisements

Google APIs & Location Based Applications -Krishna Achanta
CE881: Mobile and Social Application Programming Simon M. Lucas Menus and Dialogs.
Google MAP KEY. JDK 1.6 버전 : keytool -list -alias androiddebugkey -keystore debug.keystore -storepass android -keypass android JDK 1.7 이후 버전 : keytool.
Cosc 5/4730 Android Maps v2. Maps V1 and V2 In March 2013 google removed the ability to get a map key for version 1. Version 2 had been introduced in.
Location based services
GPS and MapView. First In the emulator, set the time zone to something (e.g., east coast) and check that the time is correct. Otherwise, the gps emulator.
Chapter 3: Engage! Android User Input, Variables, and Operations
CS378 - Mobile Computing Maps. Using Google Maps Like other web services requires an API key from Google ons/google-apis/mapkey.html.
Chapter 11: Discover! Incorporating Google Maps
Location-Based Services: Part 2 (Google Maps)
Android Development (Basics)
Android Tutorial Larry Walters OOSE Fall References This tutorial is a brief overview of some major concepts…Android is much richer and more complex.
INTERNATIONAL SUMMER ACADEMIC COURSE UNIVESITY OF NIS ISAC – Android programming.
Android Application Development 2013 PClassic Chris Murphy 1.
CS378 - Mobile Computing Maps. Using Google Maps Content on using Google Maps inside your app Alternatives: Open Street Maps –
Presented by…. Group 2 1. Programming language 2Introduction.
Mobile Programming Lecture 1 Getting Started. Today's Agenda About the Eclipse IDE Hello, World! Project Android Project Structure Intro to Activities,
Programming with Android: The Google Maps Library Slides taken from Luca Bedogni Marco Di Felice.
Android Boot Camp for Developers Using Java, Comprehensive: A Guide to Creating Your First Android Apps Chapter 9: Customize! Navigating with a Master/Detail.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
Google Maps Android API v2 吳俊興 國立高雄大學 資訊工程學系 CSF645 – Mobile Computing 行動計算
 Understanding an activity  Starting an activity  Passing information between activities  Understanding intents  Understanding the activity lifecycle.
CS378 - Mobile Computing Web - WebView and Web Services.
Location based services Using Google Maps v2 etc. in Android apps 1Location based services.
Mobile Programming Lecture 16 The Facebook API. Agenda The Setup Hello, Facebook User Facebook Permissions Access Token Logging Out Graph API.
FINAL PRESENTATION SYDNEY TOUR. Divya Nalla Raja Kandasamy RajaShekar Donti Ren Zhu Sadah Omar Sulaiman
Mobile Programming Lecture 14 Communicating via the Internet.
Social network Twitter Hashtag: #m2eu #android Personal Israel Ferrer –
PARSING FACEBOOK DATA FOR ANDROID 1. Step by Step  Import Android SDK  Get the hash key  Create a new app  Create a new project in Eclipse 
Google Cloud Messaging for Android (GCM) is a free service that helps developers send data from servers to their Android.
Win8 on Intel Programming Course Modern UI HelloWorld in HTML5/JS Cédric Andreolli Intel.
Mobile Device Security
CS378 - Mobile Computing Web - WebView and Web Services.
Engage! Android User Input, Variables,
Reports and Learning Resources Module 5 1. SLMS Primary Administrator Training Module 5: Reports and Learning Resources 2.
EText for iPad App and Production Overview for HiEd.
Mobile Programming Lecture 3 Debugging. Lecture 2 Review What widget would you use to allow the user to enter o a yes/no value o a range of values from.
Mobile Programming Lecture 11 Animation and TraceView.
Video Games list lab 6  At the end of this lab you will be expected to know:  What Views, View Groups, Layouts, and Widgets are and how they relate to.
HW#9 Clues CSCI 571 Fall, HW#9 Prototype
Mapping local community assets online Read this if you want to learn how to: 1)Create online maps of local community assets using Google Maps 2)Allow other.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Recap of Part 1 Terminology Windows FormsAndroidMVP FormActivityView? ControlViewView? ?ServiceModel? Activities Views / ViewGroups Intents Services.
1 Java Server Pages A Java Server Page is a file consisting of HTML or XML markup into which special tags and code blocks are inserted When the page is.
TCS Internal Maps. 2 TCS Internal Objective Objective :  MAPS o Integration of Maps.
Intoduction to Andriod studio Environment With a hello world program.
© 2016 Cengage Learning®. May not be scanned, copied or duplicated, or posted to a publicly accessible website, in whole or in part. Android Boot Camp.
Cosc 5/4735 YouTube API. YouTube The YouTube Android Player API enables you to incorporate video playback functionality into your Android applications.
Cosc 5/4735 Voice Actions Voice Interactions (API 23+)
LAB#8 PKI & DIGITAL CERTIFICATE CPIT 425. Public Key Infrastructure PKI 2  Public key infrastructure is the term used to describe the laws, policies,
Developing for Chromecast Cast Companion Library & Custom Receiver Application.
GPS and MapView. First In the emulator, set the time zone to something (e.g., east coast) and check that the time is correct. Otherwise, the gps emulator.
Accelerometer based motion gestures for mobile devices Presented by – Neel Parikh Advisor Committee members Dr. Chris Pollett Dr. Robert Chun Dr. Mark.
School of Engineering and Information and Communication Technology KIT305/KIT607 Mobile Application Development Android OS –Permissions (cont.), Fragments,
CS371m - Mobile Computing Maps. Using Google Maps Content on using Google Maps inside your app Alternatives Exist: – Open Street Maps –
REDCap External Modules
Android Programming - Features
Android Application Web 1.
Android Application Maps 1.
Location-Based Services: Part 2 (Google Maps)
Mobile Application Development Chapter 4 [Android Navigation and Interface Design] IT448-Fall 2017 IT448- Fall2017.
Sensors, maps and fragments:
All about Technology: Using Voki Avatar in the classroom
CS371m - Mobile Computing Maps.
Programming with Android: The Google Maps Library
Android Developer Fundamentals V2 Lesson 1
Activities and Fragments
CS 240 – Advanced Programming Concepts
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

Lecture 13 Mobile Programming Google Maps Android API

Agenda Generating SHA1 Fingerprint Signing up for API Key (as developer) Permissions MapFragment and GoogleMap object Layers MyLocation

Google Maps API Key In order to use the Google Maps API, you first need to obtain an API key and configure your app GoogleMap API v1 is obsolete!! Now, you better use GoogleMap API v2. o CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw o Please read page 863 – 970 in your textbook!

Getting the SHA1 Fingerprint To register for a Maps API Key, you need to provide an SHA1 fingerprint of the certificate that you will use to sign your application Navigate to C:\Documents and Settings\ \.android Run the following command keytool -list –v –keystore debug.keystore -alias androiddebugkey -storepass android -keypass android Copy the text that comes after Certificate fingerprint (SHA1): Go Google API Console and sign up for the Android Maps API Save the generated API key, you will use it in your app.

Use (Support) WebFragment In the layout file: You need define a Give it an id, so you can access it in source code. Class=“com.google.android.gms.maps.MapFragmen t” or SupportMapFragment depending on the version of your phone.

Use (Support) WebFragment In the java file: SupportMapFragment mapFrag = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapView) GoogleMap map = mapGrag.getMap(); CameraUpdate center = CameraUpdateFactory.newLatLng(new LatLng(x, y), where x and y are double/float. map.moveCamera(center) CameraUpdate zoom = CameraUpdateFactory.zoomTo(15). map.animateCamera(zoom)

Add Marker or OverlayItem Create Marker object MarkerOptions mo = new MarkerOptions().position(LatLng).title(“text”).snippet( “text”).draggable(true); Add a marker to the map object. Map.addMarker(mo);

Customized Info Window Create a new class that implements InfoWindowAdapter Class PopupAdapter implements InfoWindowAdapter{ LayoutInflater inflater; PopupAdapter(LayoutInflater inflater){ this.inflater = inflater; public View getInfoContents(Marker marker){ }

Customized Info public View getInfoContents(Marker marker){ View popup = inflater.inflate(R.layout.popup, null); TextView tv = (TextView) popup.findViewById(); tv.setText(Marker.getTitle); return popup; Public View getInfoWindow(Marker marker) { return null;}

Customized Info Window In java file: map.setInfoWindowAdapter(new PopuoAdapter(getLayoutInflater()));

Find My Location In java file: map.setMyLocationEnabled(true); You must call map.setOnMyLocationChangeListener(Listener) The listener must override the method: Public void onMyLocationChange(Location lastKnownLocation)

Map Listeners setOnCameraChangeListener(this) o implement OnCameraChangeListener o Override public void onCameraChange(CameraPosition position) setMyLocationChangeListener(this): o implement OnMyLocationChangeListener o Override public void onMyLocationChange(Location lastKnownLocation) If you set marker.draggable(true) o Implement OnMarkerDragListener o Override three methods:  onMarkerDrag(Marker maker)  onMarkerDragEnd(Marker marker)  onMarkerDragStart(Marker marker)

Guesture The user can change zoom level either by + and - buttons or via “pinch-to zoom” gestures The user can change the center of the map via simple swipe gestures The user can change the camera tilt via two-finger vertical swipes, so instead of a traditional top-down perspective, the user can see things on an angle The user can change the orientation of the map via a two-finger rotating swipe, to change the typical “north is to the top of the map” to some other orientation

Control You can enable and disable those gestures by: o setRotateGesturesEnabled() o setScrollGesturesEnabled() (for panning the map) o setTiltGesturesEnabled() o setZoomControlsEnabled() (for the + and - buttons) o setZoomGesturesEnabled() (for pinch-to-zoom) o SetCompassEnable()

JSON Values "title" : "IT Business Analyst Intern" "organization" : "Medtronic" "city" : "Brooklyn Park"

JSON Arrays "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"]

JSON Objects { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/10", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] }

Parsing JSON JSONObject json = new JSONObject(raw); final String moviePlot = "" + json.getString("Plot"); mTextMoviePlot.post(new Runnable() public void run() { mTextMoviePlot.setText(moviePlot); } });

Parsing JSON JSONObject json = new JSONObject(raw); final String moviePlot = "" + json.getString("Plot"); mTextMoviePlot.post(new Runnable() public void run() { mTextMoviePlot.setText(moviePlot); } }); JSONObject is a set of name/value mappings, can represent a JSON document

Parsing JSON JSONObject json = new JSONObject(raw); final String moviePlot = "" + json.getString("Plot"); mTextMoviePlot.post(new Runnable() public void run() { mTextMoviePlot.setText(moviePlot); } }); Retrieve the plot of the movie

Parsing JSON Parsing JSON is not always this simple however, but it's usually straightforward once you understand JSON A JSONObject may consist of more JSONObjects, JSONArrays, Strings, Booleans, Integers, etc

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] }

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } This is a JSONObject

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } You can get title by calling getString("title") on the JSONObject

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } You can get organization by calling getString("organization") on the JSONObject

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } Etcetera, etcetera...

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } This however, is not a String, but an array. Get this by calling getJSONArray() on the JSONObject

Parsing JSON { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] } After which you can use the getters on the JSONArray to get the desired data

Parsing JSON How would you represent this data using XML? { "title" : "IT Business Analyst Intern", "organization" : "Medtronic", "city" : "Brooklyn Park", "state" : "MN", "start_date" : "05/10", "end_date" : "07/11", "details" : [ "bla bla bla", "drank some soda", "hit manager in face with pie"] }

Parsing JSON See HttpGetJsonExample.tar

FACEBOOK API See FacebookApiExample.tar See FacebookHello.tar

References The Busy Coder's Guide to Android Development - Mark Murphy The Busy Coder's Guide to Android Development - Mark Murphy Android Developers The Mobile Lab at Florida State University