Introducing to Location in Android LOCATION IS EVERYTHING Kamil Lelonek Kamil Lelonek

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
Bruce Scharlau, University of Aberdeen, 2010 Android and Location Mobile Computing Unless otherwise stated, images are from android sdk.
SQLite. Command line sqlite3 The command line sqlite3 is not installed on all devices To install, get sqlite3 from web page, and $ adb push sqlite3 /sdcard/
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
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.
Location & Maps.  Mobile applications can benefit from being location-aware, e.g.,  Routing from a current to a desired location  Searching for stores.
Location Aware Devices  Location information can lead to creative applications  GPS hardware  cell tower positioning.
Cosc 5/4730 GPS/Location Blackberry JSR-179: javax.microedition.location and android.location.
Location and Maps Content Getting Location Getting Google Map In application Test on Emulator/Device.
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.
Programming Mobile Applications with Android September, Albacete, Spain Jesus Martínez-Gómez.
CS5103 Software Engineering Lecture 08 Android Development II.
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.
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.
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 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.
Click & Fix 9/22/10 James Cui Janam Jhaveri Paul Mongold.
LocationListener in Android Nasrullah. The LocationManager provides access to the system location services The LocationListener is used for receiving.
Event-driven design will set you free The Observer Pattern 1.
Android - Location Based Services. Google Play services facilitates adding location awareness to your app with automated location tracking Geo fencing.
Cosc 5/4730 Android Maps v2 Blackberry Maps. Android.
Sensors – Part 2 SE 395/595. Location in Android LocationManager class – Configure providers and their listeners LocationListener class – Handles update.
Manual Testing Lesson 3 Test Driving your application.
© 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 4735 LocationAware API. Previous on … Before we looked at GPS location. – d-gpslocation.pptx
Event-driven design will set you free The Observer Pattern 1.
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.
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.
CS378 - Mobile Computing Location (Location, Location, Location)
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.
Location Services: Part 1 (Location and Geocoding)
Android Application Maps 1.
Tracking device movements
AnDroid GoogleMaps API
Tracking and Booking Taxi
Designing Apps Using The WebView Control
Android Location Based Services
Sensors, maps and fragments:
CIS 470 Mobile App Development
Location (Location, Location, Location)
Proposed Solution To Parts Of
Android Topics UI Thread and Limited processing resources
CIS 470 Mobile App Development
CS378 - Mobile Computing Location and Maps.
Maps, Geocoding, and Location-Based Services.
Mobile Programming Dr. Mohsin Ali Memon.
Presentation transcript:

Introducing to Location in Android LOCATION IS EVERYTHING Kamil Lelonek Kamil Lelonek

What we gonna talk about? Introduction to GEOgraphy How we „describe” the Earth? How we calculate coordinates? Important issues to avoid problems Finding user location Prepare to coding Ways to obtain current position This time emulator is helpful Developing Maps application GeoCoding Good old Google Maps API v1 New look and feel Google Maps API v2 Summary Navigation PRO tips for advanced users Q&A

Let’s go back to school º - degrees ’ - minutes ’’ - seconds East (E)West (W) (N) (S)

How to calculate it? 23º25’24’’ S 23º25’24’’ S→– 23, (double) 23º25’24’’ S→– 23, (double) (int) = 1E6 * (double) → – (int)

Attention Problems Extras

Get prepared Permissions oACCESS_MOCK_LOCATION - emulator oACCESS_COARSE_LOCATION - approximate oACCESS_FINE_LOCATION - precise oACCESS_LOCATION_EXTRA_COMMANDS oINSTALL_LOCATION_PROVIDER LocationManager LocationProvider LocationListener

LocationManager LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); List providersAll = locationManager.getAllProviders(); List providersEnabled = locationManager.getProviders(true); Location lastKnownLocation = locationManager.getLastKnownLocation(String provider); Location double getLatitude() double getLongitude() if(hasAltitude()) getAltitude() float distanceTo(Location dest) String getProvider()

Criterias String getBestProvider(Criteria criteria, boolean enabledOnly) Criteria criteria = new Criteria(); int ACCURACY_COARS int ACCURACY_FINE int ACCURACY_HIGH int ACCURACY_LOW int ACCURACY_MEDIUM int NO_REQUIREMENT int POWER_HIGH int POWER_LOW int POWER_MEDIUM void setAccuracy(int accuracy) void setAltitudeRequired(boolean altitudeRequired) void setBearingAccuracy(int accuracy) void setBearingRequired(boolean bearingRequired) void setCostAllowed(boolean costAllowed) void setHorizontalAccuracy(int accuracy) void setPowerRequirement(int level) void setSpeedAccuracy(int accuracy) void setSpeedRequired(boolean speedRequired) void setVerticalAccuracy(int accuracy)

LocationProviders LocationProvider getProvider(String name) boolean hasMonetaryCost() boolean requiresCell() boolean requiresNetwork() boolean requiresSatellite() boolean supportsAltitude() boolean supportsBearing() boolean supportsSpeed() of 24

LocationListener new LocationListener() public void onStatusChanged(String provider, int status, Bundle extras) public void onProviderEnabled(String provider) public void onProviderDisabled(String provider) public void onLocationChanged(Location location) {} } new LocationListener() public void onStatusChanged(String provider, int status, Bundle extras) public void onProviderEnabled(String provider) public void onProviderDisabled(String provider) public void onLocationChanged(Location location) {} } void requestLocationUpdates(String provider, long minTime, float minDistance, LocationListener listener)

Using Emulator and DDMS > telnet localhost 5554 > geo fix

GeoCoding private void doInBackground() { List foundGeocode; double latitude; double longitude; try { foundGeocode = new Geocoder(this).getFromLocationName("ADDRESS", N); for(int n = 0; n < N; n++) { latitude = foundGeocode.get(n).getLatitude(); longitude = foundGeocode.get(n).getLongitude(); } catch(IOException) { // Log.e(...); }

Google Maps Android v1 API (Deprecated?) Note: Version 1 of the Google Maps Android API has been officially deprecated as of December 3rd, This means that from March 18th, 2013 you will no longer be able to request an API key for this version. No new features will be added to Google Maps Android API v1. However, apps using v1 will continue to work on devices. Existing and new developers are encouraged to use Google Maps Android API v2.Google Maps Android API v2

Google Maps Android v1 API private void setUpMap() { mapView = (MapView) findViewById(R.id.mapView); mapView.setBuiltInZoomControls(true); mapView.setOnSingleTapListener(new OnSingleTapListener() public boolean onSingleTap(MotionEvent e) {} }); mapOverlays = mapView.getOverlays(); myLocationOverlay = new MyLocationOverlay(this, mapView); myLocationOverlay.enableMyLocation(); myLocationOverlay.enableCompass(); myLocationOverlay.runOnFirstFix(new Runnable() public void run() { MapController mapController = mapView.getController(); mapController.animateTo(currentLocation); mapController.setZoom(17); mapView.getOverlays().add(myLocationOverlay); } }); mapOverlays.add(myLocationOverlay);

Google Maps Android API v2

Weaknesses: No Android Emulator suport! Poor documented… Requires powerfull device to display 3D view // Construct a CameraPosition focusing on PWr // and animate the camera to that position. CameraPosition cameraPosition = new CameraPosition.Builder().target(new LatLng( , )) // Sets the center of the map to C-13.zoom(17) // Sets the zoom.bearing(90) // Sets the orientation of the camera to east.tilt(30) // Sets the tilt of the camera to 30 degrees.build(); // Creates a CameraPosition from the builder map.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); Google Maps Android API v2

Summary It would be quite nice to remember and take care about: Efficency Battery saving Networking data