Advanced Android - GodSpeed
Upcoming SlideShare
Loading in...5
×
 

Advanced Android - GodSpeed

on

  • 2,201 views

 

Statistics

Views

Total Views
2,201
Views on SlideShare
1,980
Embed Views
221

Actions

Likes
1
Downloads
134
Comments
1

2 Embeds 221

http://rohitghatol.com 220
http://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • s
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Advanced Android - GodSpeed Advanced Android - GodSpeed Presentation Transcript

  • Advanced Android Features By Rohit Ghatol From Pune Google Technology User Group http://pune-gtug.blogspot.com
  • What is Pune-GTUG? GTUG stands for Google Technology User Group
  • Advanced Android Features
  • GodSpeed Application
      • Name - GodSpeed
      • Purpose – Turn by Turn GPS Navigation
      • Status – In Development
      • Synopsis
        • Use can type in the name of the location the user wants to go and GodSpeed will show on the Map the way to reach there. Also, GodSpeed will inform the user using Voice, when a turn is coming. The Map can rotate to make it easier for the user to understand where to head
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • GodSpeed Application In Action
  • Android Feature List
      • Use of Relative Layout
      • Use of MapView
      • Use of GPS (LocationManager and Geocoder)
      • Use of Google Directions
      • Use of Sensors
      • Use of ViewGroup
  • GodSpeed Building Blocks GodSpeed Activity DestinationSelector Activity + - Deccan, Pune Enter Destination Get Direction
  • GodSpeed Building Blocks GodSpeed Activity + - Deccan, Pune RelativeLayout TextView LinearLayout Button ViewGroup MapView
  • GodSpeed Building Blocks GodSpeed Activity DestinationSelector Activity + - Deccan, Pune Enter Destination Get Direction ____ _____ Get Direction Enable Compass Invoke activity using context.startActivityForResult()
  • GodSpeed Building Blocks DestinationSelector Activity Enter Destination Aditya Garden City,Pune Get Direction GodSpeed Activity + - Deccan, Pune SetResult with Intent containing Address and finish activity
  • GodSpeed Building Blocks GodSpeed Activity + - Deccan, Pune
      • Google Direction is used to get the route
      • Google Direction returns way points shown by marker
      • It also returns encoded Polyline, shown as blue line
      • Overlay is used to plot the Markers and the blue line
  • GodSpeed Rotation Explained GodSpeed Activity Rotate3DView ViewGroup dispatchDraw( Canvas canvas) SensorListener onSensorChanged()
      • onSensorChanged invalidate() is called
      • This calls the dispatchDraw() of ViewGroup
      • Canvas is rotated
  • GodSpeed Turn by Turn Voice Notification (Yet to be implemented) GodSpeed Activity
      • Use LocationManager’s
        • addProximityAlert to add latitude and longitude of the next way point OR
        • requestLocationUpdates() to get constant update on location. Check whether we are in proximity of next way point
        • And once we are in proximity use TTS library to yell out to the end user
  • Use of Relative Layout <?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <RelativeLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height= &quot;wrap_content&quot;> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:id=&quot;@+id/mapview&quot; android:layout_width= &quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;> </LinearLayout> <TextView android:id= &quot;@+id/currentLocation&quot; android:textColor=&quot;#000000&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignTop= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> </TextView> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;horizontal&quot; android:id=&quot;@+id/zoomControl&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignBottom= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> <Button android:id= &quot;@+id/zoomIn&quot; android:text=&quot;+&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> <Button android:id= &quot;@+id/zoomOut&quot; android:text=&quot;-&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> </LinearLayout> </RelativeLayout>
  • Use of Relative Layout <?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <RelativeLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height= &quot;wrap_content&quot;> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:id=&quot;@+id/mapview&quot; android:layout_width= &quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;> </LinearLayout> <TextView android:id= &quot;@+id/currentLocation&quot; android:textColor=&quot;#000000&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignTop= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> </TextView> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;horizontal&quot; android:id=&quot;@+id/zoomControl&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignBottom= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> <Button android:id= &quot;@+id/zoomIn&quot; android:text=&quot;+&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> <Button android:id= &quot;@+id/zoomOut&quot; android:text=&quot;-&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> </LinearLayout> </RelativeLayout>
  • Use of Relative Layout <?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <RelativeLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height= &quot;wrap_content&quot;> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:id=&quot;@+id/mapview&quot; android:layout_width= &quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;> </LinearLayout> <TextView android:id= &quot;@+id/currentLocation&quot; android:textColor=&quot;#000000&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignTop= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> </TextView> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;horizontal&quot; android:id=&quot;@+id/zoomControl&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignBottom= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> <Button android:id= &quot;@+id/zoomIn&quot; android:text=&quot;+&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> <Button android:id= &quot;@+id/zoomOut&quot; android:text=&quot;-&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> </LinearLayout> </RelativeLayout>
  • Use of Relative Layout <?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <RelativeLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:layout_width=&quot;fill_parent&quot; android:layout_height= &quot;wrap_content&quot;> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;vertical&quot; android:id=&quot;@+id/mapview&quot; android:layout_width= &quot;fill_parent&quot; android:layout_height=&quot;fill_parent&quot;> </LinearLayout> <TextView android:id= &quot;@+id/currentLocation&quot; android:textColor=&quot;#000000&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignTop= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> </TextView> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:orientation= &quot;horizontal&quot; android:id=&quot;@+id/zoomControl&quot; android:layout_width= &quot;wrap_content&quot; android:layout_height=&quot;wrap_content&quot; android:layout_alignBottom= &quot;@+id/mapview&quot; android:layout_centerHorizontal= &quot;true&quot;> <Button android:id= &quot;@+id/zoomIn&quot; android:text=&quot;+&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> <Button android:id= &quot;@+id/zoomOut&quot; android:text=&quot;-&quot; android:layout_width=&quot;80px&quot; android:layout_height=&quot;wrap_content&quot; android:textSize=&quot;12pt&quot; android:textStyle=&quot;bold&quot;/> </LinearLayout> </RelativeLayout>
  • Use of MapView
      • Prerequistes
        • The containing Activity has to be MapActivity
        • Need a API Key - read  Obtaining a Maps API Key
        • Android Manifest requires
          • <uses-library android:name=&quot;com.google.android.maps&quot; />
          • <uses-permission android:name=&quot;android.permission.INTERNET&quot; />
  • Use of MapView
      • Prerequistes
        • The containing Activity has to be MapActivity
        • Need a API Key - read  Obtaining a Maps API Key
        • Android Manifest requires
          • <uses-library android:name=&quot;com.google.android.maps&quot; />
          • <uses-permission android:name=&quot;android.permission.INTERNET&quot; />
  • Use of MapView (Manifest) <?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?> <manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot; package=&quot;org.punegtug.godspeed&quot; android:versionCode=&quot;1“ android:versionName=&quot;1.0&quot;> <application android:icon=&quot;@drawable/icon&quot; android:label=&quot;@string/app_name“ android:debuggable=&quot;true&quot;> <uses-library android:name=&quot;com.google.android.maps&quot; /> <activity android:label=&quot;@string/app_name&quot; android:name=&quot;.activities.GodSpeed&quot;> <intent-filter> <action android:name=&quot;android.intent.action.MAIN&quot; /> <category android:name=&quot;android.intent.category.LAUNCHER&quot; /> </intent-filter> </activity> <activity android:label=&quot;@string/app_name&quot; android:name=&quot;.activities.DestinationSelector“></activity> </application> <uses-sdk android:minSdkVersion=&quot;3&quot; /> <uses-permission android:name=&quot;android.permission.INTERNET&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_GPS&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_LOCATION&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_ASSISTED_GPS&quot; /> <uses-permission android:name=&quot;android.permission.ACCESS_CELL_ID&quot; /> </manifest>
  • Simple MapView App (mapView.xml) <?xml version= &quot;1.0&quot; encoding=&quot;utf-8&quot;?> <LinearLayout xmlns:android= &quot;http://schemas.android.com/apk/res/android&quot; android:id= &quot;@+id/main&quot; android:layout_width= &quot;fill_parent&quot; android:layout_height= &quot;fill_parent&quot;> <com.google.android.maps.MapView android:layout_width= &quot;fill_parent&quot; android:layout_height= &quot;fill_parent&quot; android:enabled= &quot;true&quot; android:clickable= &quot;true&quot; android:apiKey= &quot;0hVRfOyOcltfCZDhWLo6B2Hv9S6g-RAMYQoO-eg&quot; /> </LinearLayout>
  • Simple MapView App ( MapViewDemo .java) import com.example.android.google.apis.R; import com.google.android.maps.MapActivity; import android.os.Bundle; public class MapViewDemo extends MapActivity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mapview); } @Override protected boolean isRouteDisplayed() { return false; } }
  • Overlay on MapView public class RouteOverlay extends Overlay { private List<GeoPoint> route=null; public RouteOverlay(List<GeoPoint> route){ this.route=route; } @Override public void draw(Canvas canvas, MapView mapView, boolean arg2) { Paint paint = new Paint(); paint.setARGB(200, 255, 0, 0); Projection projection=mapView.getProjection(); paint.setStrokeWidth(5); paint.setAlpha(50); for(int index=0;index<route.size()-1;index++){ Point fromPoint=projection.toPixels(route.get(index), null); Point toPoint=projection.toPixels(route.get(index+1), null); canvas.drawLine(fromPoint.x,fromPoint.y,toPoint.x,toPoint.y, paint); } super.draw(canvas, mapView, arg2); } }
  • Use of GPS (LocationManager)
      • LocationManager uses
        • Get Current GPS Location
        • Add Listeners for GPS Events and Proximity alerts
        • GPS Events include
          • Getting status of GPS (whether fix is there or not)
          • Getting latitude and longitude
        • Proximity alerts are fired when we are in proximity of a given latitude and longitude
  • LocationManager Code //Getting the current GPS Position LocationManager manager = (LocationManager) context .getSystemService(Context. LOCATION_SERVICE); String provider = manager.getBestProvider( new Criteria(), true); Location location = manager.getLastKnownLocation(provider);
  • LocationManager Code // Registering for regular updates on GPS public void requestLocationUpdates (String provider, long minTime, float minDistance, LocationListener listener) minTime – milliseconds minDistance – meters
  • LocationManager Code
    • // Registering for regular updates on GPS
    • locationListener = new LocationListener() {
      • @Override
      • public void onLocationChanged(Location location) {
      • }
      • @Override
      • public void onProviderDisabled(String provider) {
      • }
      • @Override
      • public void onProviderEnabled(String provider) {
      • }
      • @Override
      • // status can be   AVAILABLE, OUT_OF_SERVICE,TEMPORARILY_UNAVAILABLE
      • public void onStatusChanged(String provider, int status, Bundle extras) {
      • }
    • };
  • Use of GPS (Geocoder)
      • Geocoder is used to
        • Get List of Addresses from given text
        • Get List of GeoPoints from given text
        • Get List of Addresses from given latitude and longitude
  • Geocoder Code //Getting geopoint from given address Geocoder coder=new Geocoder(); List<Address> addresses = coder.getFromLocationName(location, 1);
  • Geocoder Code //Reverse Geocoding - Getting address from given latitude and longitude Geocoder coder=new Geocoder(); List<Address> addresses = coder.getFromLocation (17.113, 84.12211, 1);
  • Use of Google Directions public String getGeoDirectionURI(GeoPoint from, GeoPoint to) { return &quot;http://maps.google.com/maps/nav?hl=US&gl=US&output=js&oe =utf8&q=from:&quot; + Utils. getLatitude(from) + &quot;,&quot; + Utils. getLongitude(from) + &quot;+to:&quot; + Utils. getLatitude(to) + &quot;,&quot; + Utils. getLongitude(to) + &quot;&key=&quot; + KEY; }
  • Use of Google Directions Example URL – http://maps.google.com/maps/nav?hl=US&gl=US&output=js&oe=utf8&q= from:18.5167,73.8563 + to:19.01973,72.8545 &key=ABQIAAAAQQcZviIzmIqVxEaMT12eqxT4XTUArVw0hfaJt-dPnDdoJ_2yihSOjsppgL4ku_kEd5DDd3kEV_K2AQ
  • Use of Google Directions Response – {&quot;name&quot;:&quot;from:18.5167,73.8563 to:19.01973,72.8545&quot;,&quot;Status&quot;:{&quot;code&quot;:200,&quot;request&quot;:&quot;directions&quot;},&quot;Placemark&quot;:[{&quot;id&quot;:&quot;&quot;,&quot;address&quot;:&quot;Shivaji Rd&quot;,&quot;AddressDetails&quot;:{&quot;Thoroughfare&quot;:{&quot;ThoroughfareName&quot;:&quot;Shivaji Rd&quot;},&quot;Accuracy&quot;: 0},&quot;Point&quot;:{&quot;coordinates&quot;:[73.856300,18.516700,0]}},{&quot;id&quot;:&quot;&quot;,&quot;address&quot;:&quot;D.S. Barato Rd&quot;,&quot;AddressDetails&quot;:{&quot;Thoroughfare&quot;:{&quot;ThoroughfareName&quot;:&quot;D.S. Barato Rd&quot;},&quot;Accuracy&quot;: 0},&quot;Point&quot;:{&quot;coordinates&quot;:[72.854500,19.019730,0]}}],&quot;Directions&quot;:{&quot;copyrightsHtml&quot;:&quot;Map data u0026#169;2009 Europa Technologies &quot;,&quot;summaryHtml&quot;:&quot;158u0026nbsp;km (about 2 hours 39 mins)&quot;,&quot;Distance&quot;:{&quot;meters&quot;:158392,&quot;html&quot;:&quot;158u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:9561,&quot;html&quot;:&quot;2 hours 39 mins&quot;},&quot;Routes&quot;:[{&quot;Distance&quot;:{&quot;meters&quot;:158392,&quot;html&quot;:&quot;158u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:9561,&quot;html&quot;:&quot;2 hours 39 mins&quot;},&quot;summaryHtml&quot;:&quot;158u0026nbsp;km (about 2 hours 39 mins)&quot;,&quot;Steps&quot;:[{&quot;descriptionHtml&quot;:&quot;Head u003Cbu003Esouthu003C/bu003E on u003Cbu003EShivaji Rdu003C/bu003E toward u003Cbu003ELaxmi Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:119,&quot;html&quot;:&quot;0.1u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:11,&quot;html&quot;:&quot;11 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.856230,18.516700,0]},&quot;polylineIndex&quot;:0},{&quot;descriptionHtml&quot;:&quot;Turn u003Cbu003Erightu003C/bu003E at u003Cbu003ELaxmi Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:1349,&quot;html&quot;:&quot;1.3u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:177,&quot;html&quot;:&quot;2 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.856270,18.515630,0]},&quot;polylineIndex&quot;:2},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003ESambhaji Bridgeu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:11,&quot;html&quot;:&quot;11u0026nbsp;m&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:26,&quot;html&quot;:&quot;26 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.843990,18.512920,0]},&quot;polylineIndex&quot;:12},{&quot;descriptionHtml&quot;:&quot;Slight u003Cbu003Eleftu003C/bu003E at u003Cbu003EN C Kelkar Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:33,&quot;html&quot;:&quot;33u0026nbsp;m&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:42,&quot;html&quot;:&quot;42 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.843880,18.512920,0]},&quot;polylineIndex&quot;:14},{&quot;descriptionHtml&quot;:&quot;Turn u003Cbu003Erightu003C/bu003E at u003Cbu003EFergusson College Rd/u003Cwbr/u003ESambhaji Bridgeu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:228,&quot;html&quot;:&quot;0.2u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:33,&quot;html&quot;:&quot;33 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.843600,18.512860,0]},&quot;polylineIndex&quot;:17},{&quot;descriptionHtml&quot;:&quot;Turn u003Cbu003Eleftu003C/bu003E at u003Cbu003EKarve Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:1759,&quot;html&quot;:&quot;1.8u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:159,&quot;html&quot;:&quot;2 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.842330,18.514500,0]},&quot;polylineIndex&quot;:20},{&quot;descriptionHtml&quot;:&quot;Slight u003Cbu003Erightu003C/bu003E at u003Cbu003EFly Overu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:431,&quot;html&quot;:&quot;0.4u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:73,&quot;html&quot;:&quot;1 min&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.827820,18.506870,0]},&quot;polylineIndex&quot;:28},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003EPaud Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:4164,&quot;html&quot;:&quot;4.2u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:379,&quot;html&quot;:&quot;6 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.824140,18.506480,0]},&quot;polylineIndex&quot;:35},{&quot;descriptionHtml&quot;:&quot;Turn u003Cbu003Eleftu003C/bu003E toward u003Cbu003EMumbai Pune Bypass Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:616,&quot;html&quot;:&quot;0.6u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:51,&quot;html&quot;:&quot;51 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.787850,18.507230,0]},&quot;polylineIndex&quot;:64},{&quot;descriptionHtml&quot;:&quot;Sharp u003Cbu003Eleftu003C/bu003E at u003Cbu003EMumbai Pune Bypass Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:20716,&quot;html&quot;:&quot;20.7u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:1156,&quot;html&quot;:&quot;19 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.792390,18.504530,0]},&quot;polylineIndex&quot;:74},{&quot;descriptionHtml&quot;:&quot;Take the ramp to u003Cbu003EMumbai Pune Express Wayu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:540,&quot;html&quot;:&quot;0.5u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:33,&quot;html&quot;:&quot;33 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.730550,18.660070,0]},&quot;polylineIndex&quot;:137},{&quot;descriptionHtml&quot;:&quot;Continue straight onto u003Cbu003EMumbai Pune Express Wayu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:94048,&quot;html&quot;:&quot;94.0u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:4309,&quot;html&quot;:&quot;1 hour 12 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.726530,18.662660,0]},&quot;polylineIndex&quot;:143},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003ESion - Panvel Express Hwyu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:7297,&quot;html&quot;:&quot;7.3u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:820,&quot;html&quot;:&quot;13 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.102830,19.020270,0]},&quot;polylineIndex&quot;:535},{&quot;descriptionHtml&quot;:&quot;Slight u003Cbu003Eleftu003C/bu003E toward u003Cbu003ESion - Panvel Express Hwyu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:884,&quot;html&quot;:&quot;0.9u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:60,&quot;html&quot;:&quot;1 min&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.045150,19.022840,0]},&quot;polylineIndex&quot;:560},{&quot;descriptionHtml&quot;:&quot;Slight u003Cbu003Eleftu003C/bu003E at u003Cbu003ESion - Panvel Express Hwyu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:4816,&quot;html&quot;:&quot;4.8u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:657,&quot;html&quot;:&quot;10 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.037750,19.025830,0]},&quot;polylineIndex&quot;:567},{&quot;descriptionHtml&quot;:&quot;Take the ramp onto u003Cbu003ESion - Panvel Express Hwyu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:5089,&quot;html&quot;:&quot;5.1u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:297,&quot;html&quot;:&quot;4 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[73.019100,19.061440,0]},&quot;polylineIndex&quot;:588},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003EVashi Bridgeu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:2524,&quot;html&quot;:&quot;2.5u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:161,&quot;html&quot;:&quot;2 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.978420,19.063410,0]},&quot;polylineIndex&quot;:612},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003EYaswanth Rao Chavan Margu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:4297,&quot;html&quot;:&quot;4.3u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:273,&quot;html&quot;:&quot;4 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.955190,19.057720,0]},&quot;polylineIndex&quot;:616},{&quot;descriptionHtml&quot;:&quot;Continue on u003Cbu003EV N Purav Margu003C/bu003E u003Cdiv class=&quot;google_note&quot;u003EGo through 1 traffic circleu003C/divu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:4086,&quot;html&quot;:&quot;4.1u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:334,&quot;html&quot;:&quot;5 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.918250,19.044520,0]},&quot;polylineIndex&quot;:628},{&quot;descriptionHtml&quot;:&quot;Slight u003Cbu003Eleftu003C/bu003E at u003Cbu003EEastern Express Hwy/u003Cwbr/u003ENH 3/u003Cwbr/u003EVasant Rao Naik Margu003C/bu003E u003Cdiv class=&quot;google_note&quot;u003EGo through 2 traffic circlesu003C/divu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:4374,&quot;html&quot;:&quot;4.4u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:377,&quot;html&quot;:&quot;6 mins&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.882520,19.053570,0]},&quot;polylineIndex&quot;:654},{&quot;descriptionHtml&quot;:&quot;At the traffic circle, take the u003Cbu003E2ndu003C/bu003E exit onto u003Cbu003EH Adenwala Rdu003C/bu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:761,&quot;html&quot;:&quot;0.8u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:87,&quot;html&quot;:&quot;1 min&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.855890,19.027280,0]},&quot;polylineIndex&quot;:677},{&quot;descriptionHtml&quot;:&quot;At the traffic circle, take the u003Cbu003E2ndu003C/bu003E exit onto u003Cbu003ED.S. Barato Rdu003C/bu003E u003Cdiv class=&quot;google_note&quot;u003EDestination will be on the rightu003C/divu003E&quot;,&quot;Distance&quot;:{&quot;meters&quot;:250,&quot;html&quot;:&quot;0.2u0026nbsp;km&quot;},&quot;Duration&quot;:{&quot;seconds&quot;:46,&quot;html&quot;:&quot;46 secs&quot;},&quot;Point&quot;:{&quot;coordinates&quot;:[72.854010,19.021070,0]},&quot;polylineIndex&quot;:685}],&quot;End&quot;:{&quot;coordinates&quot;:[72.854486,19.019713,0]},&quot;polylineEndIndex&quot;:692}],&quot;Polyline&quot;:{&quot;id&quot;:&quot;route&quot;,&quot;points&quot;:&quot;kp_pBm`xaMtEG??PdAnAvBjBvERbDBdFpCfd@z@rE`BvEFb@???T??NXC??wFpEoAj@??jDjDrApBjBpGtHlRlE|LdOd^~BrG??xBtG`A~DEnBKd@Uj@eAfA??s@v@_OlL{C`D}@dCKl@IjCZrHjAnJxAxHdMlAhD`CvCb@xEPt@zBpFTzBj@hKf@pNq@pFi@|GYpGeAhOApFsBz[RfCzBxHVZjAX??IeCNeCb@kCj@cBdAgBjAuAnCgBtCiAL_@??qDdA}BtAcA`AsBbDe@lAc@jBQvDp@xTAhDOhDoI~p@}A~Fy@hBuKbOwDxCiHhDwDz@_Fj@iCR_FHkFUeNwBcCkA{MiJeBqAcCkC}@cB{@{B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hCqDhNqFxTwAdHe@pDMdUzAzc@PvLCdB??fBzDb@ZFQn@~AtFjW`cAdAxChA~BdBbChAlA|DtDjD|B`MhDf@_@j@CXF`@h@?p@~PjKvz@tX`ErBdHnF??`AUl@@l@Rf@jA@v@zRhCtKhB??h@aBx@}@^Q`AOr@Nn@l@Yb@&quot;,&quot;levels&quot;:&quot;BBB??@?????BBBB?BB?BB??????BB?@???BB??@??@???@????@?@??????@???BB???@????BB??@??@???@?@?@?A???@?@???@??????@??@????A??????@????????@????BB?@??BB?@????A?????@???@????@??A??@??????@????A???@?@?@??????A???????A??????????@?@????@??@???@??A???@??@???@???@??A??@??@???A??@????@???@?????A?????@??????A??@???@????????@????@???A??@??????@?????@?????A????@??@???????@??@???@????@??????@?@???@?@?????@??@????@??@?A??@???@??????@?????@?@???@???A???@???@??@???@?????@???@???@???@???@??A????@????A????@???@???A????@????@????A????????????????@??????BB????????A???@?????@??@?BB?@???BB@?????@???@????@???BB???@???????????@??@@??BB??BB???@??@???BB?????????@?????@???@????BB?????@???@???????????BB??????BB??@???B&quot;,&quot;numLevels&quot;:4,&quot;zoomFactor&quot;:16}}}
  • Use of Sensors SensorManager mSensorManager = (SensorManager) getSystemService( SENSOR_SERVICE); mSensorManager.registerListener(mRotateView, SensorManager. SENSOR_ORIENTATION, SensorManager. SENSOR_DELAY_NORMAL);
  • Use of Sensors
    • public class RotateView implements SensorListener {
    • private int mHeading = 0;
      • public abstract void onSensorChanged(int sensor, float[] values){
      • // Rotation around Z Index
      • mHeading= values[0];
      • //Rotate Map here
      • }
      • public abstract void onAccuracyChanged(int sensor, int accuracy){
      • }
    • }
  • Use of ViewGroup
      • ViewGroup is used in GodSpeed to achieve rotation of map
      • ViewGroup also implements SensorListener
      • Logic
        • When ever the onSensorChanged method is called, it records the rotation and invalidates the view
        • This calls dispatchDraw(Canvas canvas). Now as we have access to the canvas we can rotate the canvas.
  • Use of ViewGroup
  • Questions? ?