google-places-api

Google Places Autocomplete + Angular2

浪尽此生 提交于 2019-12-04 03:59:57
I am building a simple Google Places Autocomplete Angular2 directive but the problem is that cannot get any prediction (the response is always empty?!)... As a proof of concept I created the simplest possible code snippet as a reference: <!DOCTYPE html> <html> <head> <script src="https://maps.googleapis.com/maps/api/js?key=[MY_API_KEY]&libraries=places" async defer></script> </head> <body> <button type="button" onclick="go()">go</button> <input id="autocomplete" type="text"></input> <script> var autocomplete = null; function go() { autocomplete = new google.maps.places.Autocomplete( (document

Google place API for android to find city

梦想的初衷 提交于 2019-12-04 03:49:28
I have seen the tutorial( tutorial ) to find the city using autocomplete text view in android.i have done everything that is instructed but now when i hit this url it always throws me an exception saying : java.net.UnknownHostException: Unable to resolve host "maps.googleapis.com": No address associated with hostname but the same url work fine when i hit through browser and i am getting the results also. Here is the code i m hitting with : public class PlacesAutoCompleteAdapter extends ArrayAdapter< String > implements Filterable{ private ArrayList<String> resultList; private static final

Google Places API types functionality..

£可爱£侵袭症+ 提交于 2019-12-04 03:12:30
问题 <html> <head> <title></title> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?libraries=places&sensor=true"></script> <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () { var input = document.getElementById('location'); var options = { types: ["locality"] }; autocomplete = new google.maps.places.Autocomplete(input, options); }); </script> </head> <body> <div>Location: <input type="text" id=

Google Places Autocomplete place_changed event fires after form submission when pressing enter

↘锁芯ラ 提交于 2019-12-04 01:03:42
问题 I've added google.maps.places.Autocomplete from the Google Maps Javascript API V3 to a basic search form. I am trying to find a reliable way to detect whether the user has chosen an item from the autocomplete list (either with mouse or keyboard) or is submitting free-form text. Code: http://jsfiddle.net/2rhL3cyk/1/ I am testing against the following basic scenarios, each of which should result in a form submission. locMatch should be true if the user selected an autocomplete item. Enter

Google Places AutocompleteService filtering by country

蓝咒 提交于 2019-12-04 00:51:36
I'm setting up a custom autocomplete field where I show locations from Google Places and events from my database that match the search query. For this reason, I'm using the Google Places Autocomplete Service to get the query predictions rather than plugging in the Places Autocomplete directly into my textfield. The problem is I can't figure out how to filter Places Autocomplete suggestions by country using the AutoComplete service. I've tried: var service = new google.maps.places.AutocompleteService(null, { types: ['cities'], componentRestrictions: {country: "au"} }); but it still shows

Restrict Google Places Autocomplete to return addresses only

别来无恙 提交于 2019-12-03 22:35:00
autocomplete = new google.maps.places.Autocomplete(input, { types: ['geocode'] }); returns streets and cities amongst other larger areas. Is it possible to restrict to streets only? I think what you want is { types: ['address'] } . You can see this in action with this live sample: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete (use the "Addresses" radio button). 来源: https://stackoverflow.com/questions/15071589/restrict-google-places-autocomplete-to-return-addresses-only

Getting “The provided API key is expired.” error on using Places API

倖福魔咒の 提交于 2019-12-03 22:05:26
I have generated Server key from Google console for Places API key. But whenever i am hitting the service i am getting " The provided API key is expired " error. I have tried regenerating the key but still got same error. I have faced same issue... But finally got resolved. Google place services will take 10 minutes to make the services available for new API KEY created. Services will start working after 10 minutes, till then we get error as "The provided API key is expired." You have to activate the access in services in Google console by going to APIs then activate Places API Make sure, your

Multiple API keys for Single Android Studio Project

别来无恙 提交于 2019-12-03 21:59:46
I'm using Google Maps API v2 for android and Google Places API, both have different api-keys to be added to manifest, but when i add both the keys, i got multiple-key error. Is it possible to add two different keys for two different APIs, if not, then what is the possible work around? <!-- Goolge Maps API Key --> <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyD****************U6QybngOI" /> <meta-data android:name="com.google.android.geo.API_KEY" android:value="AIzaSyA******************KDaKCEJU" /> You will want to use gradle with Placeholders . <meta-data

Google Places API Autocomplete get cities List only

对着背影说爱祢 提交于 2019-12-03 21:16:46
I am implementing google's places autocomplete on my Android app and it is working which show every similar places, but how can I get cities suggestions only when user tries to search anything. I have searched alot I was unable to find similar problems for Android places autocomplete. I have implemented PlaceAutocompleteAdapter from google's example and this how it looks like PlaceAutocompleteAdapter package com.tribikram.smartcitytraveler; import android.content.Context; import android.graphics.Typeface; import android.text.style.CharacterStyle; import android.text.style.StyleSpan; import

How can I restrict the Google Maps Places Library's Autocomplete to suggestions of only one city's places?

*爱你&永不变心* 提交于 2019-12-03 20:02:58
问题 I am currently using the given code, but this only restricts suggestions to one country. I have seen one implementation but its using jQuery and I want to do it without using jQuery. var input = document.getElementById('searchTextField'); var options = { //types: ['(cities)'], componentRestrictions: { country: 'pk' } }; var autocomplete = new google.maps.places.Autocomplete( input, options ); 回答1: Try adding a bounds property to the options object you are passing to the Autocomplete