Skip to content

Ayaa17/google-place-api-wapper-android

Repository files navigation

Google Place API Wrapper for Android

Release License

A lightweight Android library that wraps Google Place API, making it easier to search places, get place details, and integrate with your Android app.

This library is distributed as an AAR and published to GitHub Packages. CI workflow automatically builds and publishes the library on every release. It is also available via JitPack.


Features

  • Simple wrapper around Google Place API for Android
  • Search places by query or coordinates
  • Get place details including location and types
  • Supports Kotlin and Java projects

Installation

1️⃣ Add JitPack repository

Edit your settings.gradle.kts and add at the end of repositories:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}

2️⃣ Add the dependency

dependencies {
    implementation("com.github.Ayaa17:google-place-api-wapper-android:v0.0.2")
}

Usage

val cb: PlaceCallback = object : PlaceCallback {
    override fun onSuccess(response: Any): Int {
        Log.d(TAG, "onSuccess: $response")
        resultText = response.toString()
        return 0
    }

    override fun onError(error: Throwable): Int {
        Log.d(TAG, "onError: $error")
        resultText = error.toString()
        return 0
    }
}

val key = "PUT_KEY_HERE" // fixme: hide sec key
placeApi = PlaceApiWapper(this, key).also {
    it.setCallback(cb) // Async need set callback
}

val keyword = "台北"
placeApi?.autocompletePlacesAsync(keyword)

Contributing

Contributions are welcome!

  • Fork the repository
  • Create a feature branch (git checkout -b feature/my-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin feature/my-feature)
  • Open a Pull Request

License

This project is licensed under the MIT License. See LICENSE for details.



About

A lightweight Android wrapper for the Google Places API, providing a simplified and Kotlin-friendly interface for common place search and detail use cases.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages