Skip to content

Instantly share code, notes, and snippets.

@mmobin789
Last active October 30, 2020 20:08
Show Gist options
  • Save mmobin789/b0067fc479f1e9741fa2db1f65db4943 to your computer and use it in GitHub Desktop.
Save mmobin789/b0067fc479f1e9741fa2db1f65db4943 to your computer and use it in GitHub Desktop.
A sample for using DrawRoute Library.
override fun onMapReady(p0: GoogleMap?) {
this.googleMap = p0
val source = LatLng(31.490127, 74.316971) //starting point (LatLng)
val destination = LatLng(31.474316, 74.316112) // ending point (LatLng)
googleMap?.run {
moveCameraOnMap(latLng = source)
//Called the drawRouteOnMap extension to draw the polyline/route on google maps
disposable = drawRouteOnMap(
getString(R.string.google_map_api_key),
source = source,
destination = destination,
context = context!!
)
}
}
override fun onDestroy() {
disposable?.dispose()
super.onDestroy()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment