Places SDK - Android
This SDK is designed to be robust, user-friendly, and easy to integrate into any application. By providing powerful features like Autocomplete, Forward Geocoding, Reverse Geocoding and Directions, along with capabilities like configurable retry logic, this SDK is a comprehensive solution for place-related functionalities.
Designed to be lightweight, easy to integrate, this SDK ensures users have a seamless experience. It also includes periodic updates, making it highly reliable and user-friendly.
Purpose
The primary purpose of the Ola-Maps-Services SDK is to enable developers to seamlessly integrate the services including Autocomplete, Reverse Geocoding, Forward Geocoding and Route/Direction,
Features
- Plug and Play:
- Easy to start with just one line of code and no extra dependencies need to be added.
- Lightweight:
- Minimal footprint in the application.
- Configurable Retry Logic:
- Users have control over the retry logic.
- Periodic Updates:
- Enhanced/optimized versions, bug fixes, and new features are provided periodically.
- Easy to Understand Documentation:
- Comprehensive and user-friendly documentation.
Pre-Requirements for Setup
- Obtain the Places SDK file from the provided link.
- Place the SDK file in your project's "libs" directory.
- In project's "build.gradle" add a dependency using
implementation(files("libs/[filename].jar")
, replace [filename] with exact jar filename in "libs" folder)
Code Changes
1. Add SDK Dependency:
Add following dependencies to your app-level build.gradle file2. Initialization:
Initialize an SDK using below provided Client Id and Client Secret3. Endpoint configuration:
Set the endpoint configuration using same PlatformConfig object4. Custom configuration:
Set the custom configuration before building the PlatformConfig objectAuto Complete / Places Service
Create an object of AutocompleteRequest class, set the input query in field queryText() method and call the autoComplete() method of PlacesClient as shown in below code snippet.
Reverse Geocoding Service
Create an object of ReverseGeocodingRequest class, set the comma separated latitude and longitude in field latlng() method and call the reverseGeocode() method of ReverseGeocodingClient as shown in below code snippet.
Forward Geocoding Service
Create an object of ForwardGeocodingRequest class, set the address in field address() method and call the forwardGeocode() method of ForwardGeocodingClient as shown in below code snippet.
Get Place Details
Create an object of PlaceDetailsRequest class, set the placeId using method placeId() and call the placeDetails() method of PlaceDetailsClient as shown in below code snippet.
Nearby Search
Create an object of NearbySearchRequest class, set the location using method location() and call the nearbySearch() method of NearbySearchClient as shown in below code snippet.
Text Search
Create an object of TextSearchRequest class, set the queryText and location using method queryText() and location() , then call the textSearch() method of TextSearchClient as shown in below code snippet.