Introducing DrawRoute: A Kotlin Library for Drawing Routes on Google Maps for Android. A compact way to draw routes in your Android app
I am happy to share DrawRoute, an open source route-drawing library to be used with the Google Maps API for Android.
Tech stack: Kotlin, OkHttp, RxJava, and AndroidX.
The library uses the Google Directions API to fetch route information when drawing on the map. It is not free and requires you to have a project with this API enabled as well as a billing account.
See how to get started.
This library is completely written in Kotlin and wraps on the boilerplate code involved in consuming the Google Directions API using reactive programming for more control and precision. It also exposes an extension function that can be used on the Google Maps object itself once the map is ready.
In your build.gradle
file (project level), add the following in the allProjects
block:
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
Then in your build.gradle
(app level), add the following in the dependencies block:
dependencies {
implementation 'com.github.malikdawar:drawroute:1.1-rx'
}
Once you’ve successfully integrated the Google Maps API and followed the integration steps above, you can call the drawRouteOnMap
method that will draw the route on the map and return as an Rx-Disposable, which should be used to dispose of the executed subscription.
A helper moveCameraOnMap
methodis also added in the library used here to focus and zoom on the source location before drawing the route.
In mobile app development, the main challenge for developers is whether the app should be built for native or cross-platform frameworks. The best way to solve this dilemma is to actually test both of them using the Kotlin Multiplatform approach. Teams can easily synchronize and deliver apps for different platforms simultaneously with this method.
AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!
Kotlin 1.4 Online Event: Kotlin everywhere: Android, Mobile Multiplatform, Kotlin/JS. State of Kotlin in Android. It's time for Kotlin Multiplatform Mobile. Kotlin/JS in 1.4 and Beyond. Diving into Kotlin Multiplatform
AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!
AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!