GithubHelp home page GithubHelp logo

urmichm / places-placesearch-ktx Goto Github PK

View Code? Open in Web Editor NEW
8.0 5.0 1.0 553 KB

Kotlin library to use Place Search from Google Places API

License: Apache License 2.0

Kotlin 100.00%
android google-maps-api java kotlin maps place-search places-api place-search-api google-places google-places-api

places-placesearch-ktx's Introduction

Maven Central Apache-2.0

Places | Place Search KTX

Description

This repository contains Kotlin extensions (KTX) for:

  1. The Places SDK for Android

It enables you to use Place Search API.

Requirements

  • API level 18+
  • Places SDK through Google Play Services

Installation

In order to use the library, include the following dependency:

dependencies {
      implementation 'com.urmich.android:placesearch-ktx:1.1.0'
 }

The result of the API call can be converted into a set of Place objects. Such conversion accelerates the usage of Place Search and integrates the package into Place Details SDK. Do not forget to have Google Places library included.

dependencies {
    implementation 'com.google.android.libraries.places:places:2.6.0'
}

Update the local.properties file in your root directory (Note: this file should NOT be under version control to protect your API key) and add a single line to local.properties that looks like PLACES_API_KEY="YOUR_API_KEY", where YOUR_API_KEY is the API key you obtained in the first step. You can also take a look at the local.defaults.properties as an example. This is the same key you created to use Places SDK.

Demo App

A demo application is contained within this repository that illustrates the use of this KTX library.

To run the demo app, you'll have to:

  1. Get a Places API key
  2. Update the local.properties file in your root directory and add lines to local.properties that looks like PLACES_API_KEY="YOUR_API_KEY" and MAPS_API_KEY="YOUR_MAPS_API_KEY".
  • YOUR_API_KEY is the API key you obtained in the first step. It is the same key you use to access Places SDK.
  • YOUR_MAPS_API_KEY is the key to the use google map. You can also take a look at the local.defaults.properties as an example.
  1. Build and run

Support

Encounter an issue while using this library?

If you find a bug or have a feature request, please file an issue. Or, if you'd like to contribute, send us a Pull Request.

For more information, check out the detailed guide on the Google Developers site.

places-placesearch-ktx's People

Contributors

urmichm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

nectariosk

places-placesearch-ktx's Issues

Single Container Class

In a separate issue, think of adding a common class for :

  • TextSearchContainer
  • NearbySearchContainer
  • FindPlaceContainer

All containers have:

  • htmlAttributions (except FindPlaceContainer, but could be made nullable)
  • results ( aka candidates in FindPlaceContainer, but we can use @JSON(name="candidates") to overcome this)
  • status
  • errorMessage
  • infoMessages
  • nextPageToken (except FindPlaceContainer, but could be made nullable)

A single container class would make it possible to make an abstract class with abstract call() method for all PlaceSearch classes

Originally posted by @urmichm in #33 (comment)

No Warnings Build

Warning to be removed

NearbySearch.kt: (273, 13): Non exhaustive 'when' statements on enum will be prohibited in 1.7, add 'null' branch or 'else' branch instead

NearbySearch

Create builder for nearbySearch with all the parameters

Tag on logs

Current log is visible as follows:

I/System.out: WARN: Vicinity is used as address

WARN

Remove Warnings

PhotoMetadata from Container

PhotoMetadataContainer to convert into PhotoMetadata

 PhotoMetadata.builder(this.photoReference)
             .setAttributions(this.attributions[0])

Triggers exception:

Exception in thread "CoroutineScheduler-worker-2" java.lang.RuntimeException: Stub!
 at android.text.TextUtils.isEmpty(TextUtils.java:59)
 at com.google.android.libraries.places.api.model.PhotoMetadata$Builder.build(com.google.android.libraries.places:places@@2.5.0:4)
 at com.github.urmichm.diana.containers.PhotoMetadataContainer.toPhotoMetadata(PhotoMetadataContainer.kt:22)

tests

Test and clean existing code

Refactor Repo

Refactors such as:
NEARBY_SEARCH_URL to be named as PLACE_SEARCH_URL and make it const

rename library

rename library
proposed names

  • places-placesearch-ktx
  • android-places-placesearch-ktx
  • places-place-search-ktx
  • place-search-ktx
  • android-placesearch-ktx
  • android-place-search-ktx

Questions! Questions that need answering!

Originally posted by @urmichm in #18 (comment)

version 1.1.0

Update readme and version, 1.1.0 is now available with

implementation 'com.urmich.android:placesearch-ktx:1.1.0'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.