Coder Social home page Coder Social logo

mikecamimo / placessearchbar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ajsmithsw/placessearchbar

0.0 1.0 0.0 105 KB

An extension of Xamarin.Forms SearchBar control for implementing Google Places Autocomplete API

License: Other

C# 100.00%

placessearchbar's Introduction

Places Search Bar

An extension of Xamarin.Forms SearchBar control for implementing Google Places Autocomplete API.

Contributing

If you wish to contribute, you're welcome to submit pull requests or get in touch.

Obtaining API key

Use the Google Developers Console to enable the 'Google Places API Web Service' and create a new API key.

Note: if you are developing for multi-platform you will likely need a separate API key for each device, and set your key property based on OS:

public static string ApiKey = Device.OS == TargetPlatform.iOS ? "add_ios_key_here" :
                                            TargetPlatform.Android ? "add_android_key_here" :
                                            TargetPlatform.WinPhone ? "add_winphone_key_here" :
                                            "...etc...";

Usage

The PlacesBar has the following properties and methods:

Type

An optional PlaceType value that sets the results based on a particular location Type

Bias

An optional LocationBias value that sets a custom location bias (see API docs for details)

ApiKey

A required string value

MinimumSearchText

An optional integer value for setting the minimum number of search characters the user should type before API calls are made (useful for stemming API call volume)

PlacesRetrieved

Subscribe to this event handler to receive search results as AutoCompleteResults objects

Retrieving Place details

The package also contains classes you can use to retrieve place details (including Latitude & Longitude)

Places class

A static class which exposes a GetPlace(placeID, apiKey) function which returns a Place object

Place class

A Place object contains Name, Latitude, Longitude and Raw (JSON response string) properties

Implementing PlacesBar

See the PlacesBarExamples solution included to see a Xamarin Forms project implementing the PlacesBar and GetPlace() features.

Notes

There is a known bug in Xamarin.Forms with Android N 7.0 where if a SearchBar's height is not set, the search bar will not display. Please explicitly set HeightRequest value to avoid this issue.

placessearchbar's People

Contributors

ajsmithsw avatar s1r-lanzelot avatar

Watchers

Michael Moran 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.