am trying implement voice route navigation google map project. don't have idea how implement this. have starting , ending points.can implement in application or redirect phones default google map ? please guide me ..
process following url locations between source , destination coordinates
stringbuilder urlstring = new stringbuilder(); urlstring.append("http://maps.google.com/maps/api/directions/xml?origin="); urlstring.append( double.tostring((double)srcgeopoint.getlatitudee6()/1.0e6 )); urlstring.append(","); urlstring.append( double.tostring((double)srcgeopoint.getlongitudee6()/1.0e6 )); urlstring.append("&destination=");//to urlstring.append( double.tostring((double)destgeopoint.getlatitudee6()/1.0e6 )); urlstring.append(","); urlstring.append( double.tostring((double)destgeopoint.getlongitudee6()/1.0e6 )); urlstring.append("&sensor=true&mode=driving");
after getting response above url encode string following method
private list<geopoint> decodepoly(string encoded) { list<geopoint> poly = new arraylist<geopoint>(); int index = 0, len = encoded.length(); int lat = 0, lng = 0; while (index < len) { int b, shift = 0, result = 0; { b = encoded.charat(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lat += dlat; shift = 0; result = 0; { b = encoded.charat(index++) - 63; result |= (b & 0x1f) << shift; shift += 5; } while (b >= 0x20); int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1)); lng += dlng; geopoint p = new geopoint((int) (((double) lat / 1e5) * 1e6), (int) (((double) lng / 1e5) * 1e6)); poly.add(p); } return poly; }
after encode between locations draw path using canvas drawing .
note: voice route may use tts(text speech)
Comments
Post a Comment