SimplePlacePicker Android
If you have a use case that requires searching and selecting a specific location on map , Here is a nice independent module that you can simply import into your project to handle this scenario with some customizations.
Features
- Rich autoComplete and search for any location with the ability to
filter results depending on country. - Get parsed string address for any location on map with a specified language.
- Restrict specific supported areas for user to only pick from .
- Listen for GPS configuration changes and ask user to enable GPS once it is disabled.
Requirements :
- Minimum SDK version 21
- Androidx
- Google Places Api key
Setup :
Before importing simpleplacepicker module into your android project, make sure that :
- your project manifest file contains internet and location permissions
- add meta_data for google api key in application tag within manifest file
Make sure that you have original google places api key not only google maps key as autocomplete won't work without Places key.
- add this code to the the project level build.gradle file
How to import as Module
- Clone or download simplePlacePicker and save it at a path that you know.
- In your android project, Go to File > New > Import Module..
- Enter the path of simpleplacepicker module and click finish.
- After android studio finishes syncing, go to File > Project Structure and select Dependencies.
- Now you should see that you have two modules , your app module and simpleplacepicker module
- Select app module and in Declared dependencies section click the plus icon and choose Module Dependency
- Choose simpleplacepicker and click Ok.
Now you are ready to use SimplePlacePicker as a part of your project ^-^
just create intent and add extras to get some customization
Example project : TestPlacePicker
SimplePlacePicker module is implemented with the help of :
- MaterialSearchBar https://github.com/mancj/MaterialSearchBar
- android-ripple-background https://github.com/skyfishjy/android-ripple-background