@Override public void onMapClick(LatLng latLng) { Log.i(TAG, " onMapClick - - - - - - - - - - - - - - -"); if (userInfo.hasItems() && !endMarker.isVisible()) { endMarker.visible(true).position(latLng); googleMap.addMarker(endMarker); UserObject usr = userInfo.dequeue(); userSession.setDestLat(endMarker.getPosition().latitude); userSession.setDestLng(endMarker.getPosition().longitude); LatLng currLoc = new LatLng(usr.getLast_lat_double(), usr.getLast_long_double()); String urlTopass = makeURL( usr.getLast_lat_double(), usr.getLast_long_double(), endMarker.getPosition().latitude, endMarker.getPosition().longitude); Log.i(TAG, "URL FOR ----------- Direction ------ " + urlTopass); new connectAsyncTask(urlTopass).execute(); } }
public void updateMap(Location location) { Log.i(TAG, " Holy Moley ..." + location.toString()); UserObject o = new UserObject("user", "" + location.getLatitude(), "" + location.getLongitude()); userInfo.enqueue(o); userInfo.enqueueLoc(location); Log.i(TAG, "new co-ordinates: ========> " + o.getLast_lat() + o.getLast_long()); userSession.setCurrLat(location.getLatitude()); userSession.setCurrLng(location.getLongitude()); // To avoid the case where we don't have enough data points if (userInfo.size() > 1) { UserObject lastInfo = userInfo.dequeue(); Location dest = userInfo.dequeueLoc(); // calcSpeed(location.getLatitude(), location.getLongitude(), // lastInfo.getLast_lat_double(), lastInfo.getLast_long_double()); calcSpeed(location, dest); } // Update friends locations if (!userSession.friends.isEmpty()) { Enumeration e = userSession.friends.elements(); while (e.hasMoreElements()) { Log.i(TAG, " next friend "); updateFriendMarker((UserObject) e.nextElement()); } } if (location.hasBearing()) { gotoMyLocation(location.getLatitude(), location.getLongitude(), location.getBearing()); } else { gotoMyLocation(location.getLatitude(), location.getLongitude(), 0f); } }