Location & Maps.  Mobile applications can benefit from being location-aware, e.g.,  Routing from a current to a desired location  Searching for stores.

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

Bruce Scharlau, University of Aberdeen, 2010 Android and Location Mobile Computing Unless otherwise stated, images are from android sdk.
Introducing to Location in Android LOCATION IS EVERYTHING Kamil Lelonek Kamil Lelonek
Location based services
Prepared by: Prepared by: Jameela Rabaya Jameela Rabaya Fatima Darawsha Fatima Darawsha.
Tracking & Login Data persistence User tracking.
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
Google Android Map API Presentation 13/03/2008. Map API – Overview (1) Map rendering facility on Android device Similar to Google Earth Integrate map.
Application Fundamentals. See: developer.android.com/guide/developing/building/index.html.
Android Application Development. Agenda  Android Business Model  Why Android  Android application market space  Market Segments & Target customers.
© 2009 Research In Motion Limited Introduction to GPS and Wi-Fi technology on BlackBerry smartphones.
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.
Android wifi-based localization. Localization types Android allows (location providers) – GPS (GPS_PROVIDER) – Cell tower + wifi (NETWORK_PROVIDER) You.
Location and Maps Content Getting Location Getting Google Map In application Test on Emulator/Device.
Bonrix Track & Trace System A GPS Based Vehicle Tracing System (SMS, GPRS/3G, Offline) Bonrix Software Systems Ahmedabad (INDIA) Website:
Cosc 5/4730 GPS/Location android.location. Simulator notes All the simulators can simulator GPS/location information – Android DDMS commands (geo) to.
CS378 - Mobile Computing Location (Location, Location, Location)
CS378 - Mobile Computing Location.
CS378 - Mobile Computing Maps. Using Google Maps Content on using Google Maps inside your app Alternatives: Open Street Maps –
Map Applications.
Android Sensors & Async Callbacks Jules White Bradley Dept. of Electrical and Computer Engineering Virginia Tech
Route Tracker App Android How to Program © by Pearson Education, Inc. All Rights Reserved.
Mobile Application Development Selected Topics – CPIT 490
CHAP 4. GEOLOCATION API.  You can request users to share their location and, if they agree, you can provide them with instructions on how to get to a.
Google Maps Android API v2 吳俊興 國立高雄大學 資訊工程學系 CSF645 – Mobile Computing 行動計算
Location-Based API 1. 2 Location-Based Services or LBS allow software to obtain the phone's current location. This includes location obtained from the.
Location Services: Part 1 (Location and Geocoding)
Location based services Using Google Maps v2 etc. in Android apps 1Location based services.
Mobile Programming Lecture 9 Bound Service, Location, Sensors, IntentFilter.
1 Localization and Sensing Nilanjan Banerjee Mobile Systems Programming (Acknowledgement: Jules White) University of Arkansas Fayetteville, AR
Social network Twitter Hashtag: #m2eu #android Personal Israel Ferrer –
Location based services
CSS216 MOBILE PROGRAMMING Android, Chapter 8 Book: “Professional Android™ 2 Application Development” by Reto Meier, 2010 by: Andrey Bogdanchikov (
INTRODUCTION TO HTML5 Geolocation. Display a Specific Location with Google Maps  You can use the Google Maps API to display a custom map on your own.
Android Accessing GPS Ken Nguyen Clayton State University 2012.
1 CMSC 628: Introduction to Mobile Computing Nilanjan Banerjee Introduction to Mobile Computing University of Maryland Baltimore County
Context Aware Location Nasrullah. Location Basics LocationManager—Class providing access to Android system location services LocationListener—Interface.
MAKANI ANDROID APPLICATION Prepared by: Asma’ Hamayel Alaa Shaheen.
GPS Provider:  GPS signal Network Location Provider:  Cell ID  Wi-Fi.
Location. GPS Global Positioning System – At least 4 satellites typically used 3 required extra for error detection and altitude typically accurate within.
Maps Dr. David Janzen Except as otherwise noted, the content of this presentation is licensed under the Creative Commons Attribution 2.5 License.
Adding Overlay Items.  So, now you have a map, but in many cases you'll also want to create your own map markers and lay-overs.  You must implement.
Adding Location Nasrullah. Adding Location Adding a Map Activity Obtaining a Map API Debug Key Adding a Map View Finding an Address with Google’s GeoCoder.
CMPE Senior Design Project Group Members: Jose A Montoya (CMPE) Carlos Olvera (CSCI)
Android - Location Based Services. Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing.
Android Application Lifecycle and Menus
Sensors – Part 2 SE 395/595. Location in Android LocationManager class – Configure providers and their listeners LocationListener class – Handles update.
Cosc 4735 LocationAware API. Previous on … Before we looked at GPS location. – d-gpslocation.pptx
Location Based Services. Android location APIs make it easy for you to build location-aware applications, without needing to focus on the details of the.
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.
Lecture 5: Location Topics: Google Play Services, Location API Date: Feb 16, 2016.
Location based services 1. Some location-based services available in Android Geo-coding – Address -> location Reverse geo-coding – Location -> address(es)
CS371m - Mobile Computing Maps. Using Google Maps Content on using Google Maps inside your app Alternatives Exist: – Open Street Maps –
3 rd -party APIs Kalin Kadiev Astea Solutions AD.
1. 2 Android location services Determining a device’s current location Tracking device movements Proximity alerts.
Location-Based Services. Objectives How to display Google Maps in your application How to control displayed maps How to perform geocoding and reverse.
CS499 – Mobile Application Development Fall 2013 Location & Maps.
Android Application Maps 1.
Tracking device movements
AnDroid GoogleMaps API
Android Location Based Services
Sensors, maps and fragments:
Location Service and Sensors
תכנות ב android אליהו חלסצ'י.
CIS 470 Mobile App Development
CIS 470 Mobile App Development
Lecture 5: Location Topics: Google Play Services, Location API.
CS378 - Mobile Computing Location and Maps.
Maps, Geocoding, and Location-Based Services.
Presentation transcript:

Location & Maps

 Mobile applications can benefit from being location-aware, e.g.,  Routing from a current to a desired location  Searching for stores near a current location  Android allows applications to determine & manipulate location

 Represents a position on the Earth  A Location instance consists of:  Latitude, longitude, a UTC timestamp  Optionally, altitude, speed, and bearing

 Represent sources of location data  Actual data may come from  GPS satellites  Cell phone towers  Internet  Different LocationProviders will exhibit different tradeoffs between cost, accuracy, availability & timeliness

 Passive  Returns locations generated by other providers  Requires android.permission.ACCESS_FINE_LOCATION  Network  Determines location based on cell tower and WiFi access points  Requires either ▪ android.permission.ACCESS_COARSE_LOCATION or android.permission.ACCESS_FINE_LOCATION  GPS  Determines location using satellites  Requires android.permission.ACCESS_FINE_LOCATION

 System service for accessing location data  getSystemService(Context.LOCATION_SERVICE)  Enables  Determining the last known user location  Registering for location updates  Registering to receive Intents when the device nears a given location

 Defines callback methods that are called when Location or LocationProvider status changes  void onLocationChanged(Location location)  void onProviderDisabled(String provider)  void onProviderEnabled(String provider)  void onStatusChanged(String provider, int status, Bundle extras)

 Start listening for updates from location providers  Maintain a "current best estimate" of location  Stop listening for location updates  Use best location estimate

public class LocationGetLocationActivity extends Activity { … public void onCreate(Bundle savedInstanceState) { … final LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); bestReading = locationManager. getLastKnownLocation(LocationManager.GPS_PROVIDER); … locationManager.requestLocationUpdates( LocationManager.GPS_PROVIDER, 0, 0, locationListener); …

final LocationListener locationListener = new LocationListener() { public synchronized void onLocationChanged(Location location) { if (location.getAccuracy() < bestReading.getAccuracy()) { bestReading = location; tv.setText(getDisplayString(location)); } … } ….

Executors.newScheduledThreadPool(1).schedule( new Runnable() { public void run() { locationManager.removeUpdates(locationListener); } }, 10000, TimeUnit.MILLISECONDS); …

 Several factors to consider  Measurement time  Accuracy  Provider type

 Location measurement drains the battery  Return updates less frequently  Restrict the set of Location Providers ▪ Use least accurate (cheaper) provider possible  Always check last known measurement

 A visual representation of area  Today’s examples use Google Maps library  Not part of standard Android distribution  Install SDK add-on  build against add-on ("Google APIs (Google Inc.)"  Permissions 

 MapActivity  MapView  GeoPoint  Overlay  ItemizedOverlay

 Base class for Activities that display MapViews  Subclass creates MapView in onCreate()  Only one MapActivity is allowed per process

 Extends ViewGroup  Displays a Map in one of several modes  Street View - photographs  Satellite View – aerial  Traffic View – real time traffic superimposed  Supports panning and zooming  Support overlay views  Requires a Maps API key  See

public class MapsEarthquakeMapActivity extends MapActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); } protected boolean isRouteDisplayed() { return false; }

<com.google.android.maps.MapView android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="true" android:apiKey=”my Maps API key" />

 Represents a location on Earth  latitude and longitude measured in microdegrees  1 microdegree == 1 millionth of a degree

21  Manages information drawn over a map  E.g., points of interest within a given city  MapView maintains a list of overlays  Retrieve via MapView.getOverlays()

22  Subclass of Overlay  Manages a list of OverlayItems  OverlayItems have a particular location  Draws a drawable at OverlayItem’s location  Keeps track of a focused item

public class MapsEarthquakeMapActivity extends MapActivity { List mapOverlays; Drawable mOverlayDrawable; EartQuakeDataOverlay itemizedOverlay; MapView mapView = null; public void onCreate(Bundle savedInstanceState) { … new HttpGetTask().execute( " 22.4&west=55.2&username=demo” ); … mapView …. mapView.setBuiltInZoomControls(true); mapOverlays = mapView.getOverlays(); mOverlayDrawable = this.getResources().getDrawable(R.drawable.pushpin_red); itemizedOverlay = new EartQuakeDataOverlay(mOverlayDrawable); }

… // called when HttpGet().execute() finishes private void onFinishGetRequest(List result) { for (EarthQuakeRec rec : result) { itemizedOverlay.addOverlay(new OverlayItem(rec.getGeoPoint(), String.valueOf(rec.getMagnitude()), "")); } mapOverlays.add(itemizedOverlay); MapController mc = mapView.getController(); mc.setCenter(new GeoPoint((int) ( * 1E6), (int) ( * 1E6))); }

public class EartQuakeDataOverlay extends ItemizedOverlay { ArrayList mOverlays = new ArrayList (); protected EartQuakeDataOverlay(Drawable defaultMarker) { super(boundCenter(defaultMarker)); } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } protected OverlayItem createItem(int i) { return mOverlays.get(i); } public int size() { return mOverlays.size(); } }