Last active
October 30, 2020 20:08
-
-
Save mmobin789/b0067fc479f1e9741fa2db1f65db4943 to your computer and use it in GitHub Desktop.
A sample for using DrawRoute Library.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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