GithubHelp home page GithubHelp logo

amranwar / simpleplacepicker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esam00/simpleplacepicker

0.0 1.0 0.0 11.89 MB

Simple place picker module for Android

License: MIT License

Java 100.00%

simpleplacepicker's Introduction

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 Android Studio v4.0

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 :

  1. Minimum SDK version 21
  2. Androidx
  3. Google Places Api key

Setup :

Before importing simpleplacepicker module into your android project, make sure that :

  1. your project manifest file contains internet and location permissions
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  1. add meta_data for google api key in application tag within manifest file
<application
    --
    --
    <meta-data
        android:name="com.google.android.geo.API_KEY"
        android:value="@string/places_api_key" />
</application>

Make sure that you have original google places api key not only google maps key as autocomplete won't work without Places key.

  1. add this code to the the project level build.gradle file
allprojects {
  repositories {
    --
    --
    maven { url "https://jitpack.io" }
  }
}

How to import as Module

  1. Clone or download simplePlacePicker and save it at a path that you know.
  2. In your android project, Go to File > New > Import Module..
  3. Enter the path of simpleplacepicker module and click finish.
  4. After android studio finishes syncing, go to File > Project Structure and select Dependencies.
  5. Now you should see that you have two modules , your app module and simpleplacepicker module
  6. Select app module and in Declared dependencies section click the plus icon and choose Module Dependency
  7. 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

        Intent intent = new Intent(this, MapActivity.class);
        Bundle bundle = new Bundle();

        bundle.putString(SimplePlacePicker.API_KEY,apiKey);
        bundle.putString(SimplePlacePicker.COUNTRY,country);
        bundle.putString(SimplePlacePicker.LANGUAGE,language);
        bundle.putStringArray(SimplePlacePicker.SUPPORTED_AREAS,supportedAreas);

        intent.putExtras(bundle);
        startActivityForResult(intent, SimplePlacePicker.SELECT_LOCATION_REQUEST_CODE);

Example project : TestPlacePicker

SimplePlacePicker module is implemented with the help of :

simpleplacepicker's People

Contributors

esam00 avatar

Watchers

James Cloos avatar

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.