Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
Unlike on iOS, when using the place picker in the Play Services package (42.1001.0), searching by text input doesn't perform a local search, which makes the feature (and thus the place picker) completely useless. This has show stopper quality, unfortunately :/
I can observe this on Android only, iOS is fine.
* Open the place picker with predefined bounds (e.g. London)
* The map shows up correctly
* Enter some characters to search for something nearby
* The suggestions are total bogus, since no local search prioritization is being performed. (On iOS, it would immediately suggest the nearby location)
Created attachment 20285 [details]
The screenshot shows the app on iOS and Android. Android displays suggestions from all over the globe, while the iOS version correctly suggests local places only that actually make sense.
Hey Philipp, the place picker is part of Play Services, not Forms, so this would be better handled by the components team.
I'm afraid there's probably not much we can do on this one, we just bind the Places picker in the Play Services java library, so if Google chooses to implement it this way, our hands are tied.
Having said that, i'd be interested to see the code you're using to perform this search and see if there's any suggestions we could give.
I'm not convinced this is Google - their PlacePicker is being used so widely, there would be tons and tons of complaints on Stack Overflow. I also posted on S/O myself, and other Android (not Xamarin) devs didn't have the issue (search results were local as you would expect). OTOH, given that their API doesn't have too much to offer, I wouldn't know where I or the framework code could have gone wrong.
Here's my code. Not too much happening here - the map zooms in nicely where I want it, it's really just the search box that messes up.
protected override void ShowPicker(PositionDto position, bool zoomLocal)
//wider search radius for destination
double offset = zoomLocal ? 0.001 : 0.03;
var northEast = new LatLng(position.Latitude + offset, position.Longitude + offset);
var southWest = new LatLng(position.Latitude - offset, position.Longitude - offset);
var bounds = new LatLngBounds(southWest, northEast);
var builder = new PlacePicker.IntentBuilder();
builder = builder.SetLatLngBounds(bounds);
Activity a = (Activity) context;
var intent = builder.Build(a);
(btw, it's also be noteworthy, that their Places autocompletion API does support local suggestions out of the box, so that wouldn't be an exotic feature). I didn't use the place picker on my initial UI due to the Xamarin Forms limitations (stuck at 184.108.40.206) and used that API myself. Right now, it's as if the map code would use the boundaries specified, while the autocompletion API calls wouldn't.
Do you have your GEO_API key specified in your metadata?
[assembly: MetaData ("com.google.android.geo.API_KEY", Value="your_key")]
I could reproduce the behaviour you were seeing, and then correct it by adding the proper metadata info as suggested in my previous comment. I'm pretty confident this is the issue.
Thanks for investing the time, I really appreciate it. I'm super excited about your repro, but it didn't do it for me :/
My understanding of the PlacePicker is that it simply doesn't work without a key. I did a few tests with those now:
* I already had an API key in my manifest file.
* Removing the key causes the PlacePicker to immediately abort after opening it.
* Replacing it with an invalid key (the one I used for iOS) also broke the component.
* Replacing it with a new unrestricted key got me back to the old behavior (starts, but no local search).
* Removing the declaration from the manifest file, and using the Assembly-level attribute as you posted instead didn't change the behavior.
I noticed that for iOS, I am registering the key twice. Shouldn't be similar in Android, but who knows:
Could you elaborate a bit on your repro please?
Sure, I haven't done anything particularly different than the code you showed me.
Here is the code I'm using:
I am using 42.1001.0 of Google Play Services and 25.1.0 of Android Support libraries, so perhaps that's something to try.
The last thing I can think of is maybe your target device doesn't have Google Play Services (or a new enough version of it) installed?
Weird, I have the same issue with your sample - both on my Galaxy S6 and the emulator. You mentioned the key and I wonder whether something's wrong there: How could you reproduce the issue and then fix it? I guess you must have specified some sort of key in order to run the place picker in the first place, not?
I'll try to run a build on a different machine tonight and will post back on that, too.
Have you enabled the Android Places API for your key in the Google Developer Console?
I did not originally specify the `com.google.android.geo.API_KEY` metadata at all. This is what made things work as you were reporting (no places showing up). Once I created a key, for my app's keystore (in this case my debug .keystore) and enabled the Android Places API for android in the Google Developer Console it all started working...
Ok, this is driving me crazy. I ran your example with an adjusted key, and it still didn't work. Then built it on an indipendent machine and it still didn't work. Tried on both physical phone and simulator. I'm attaching now a complete project - if that one does work on your machine, but it doesn't on any of mine, this might be a culture setting causing the issue.
I also created a new Google project for this one, that has an independent key.
Thanks for bearing with me!
Created attachment 21406 [details]
Sample app (not working)
Sample app with an unrestricted Google key (Places API for Android enabled in the Google console).
Hey Philipp, just tried your code... No changes, just built and ran on emulator, and it works fine here:
Not sure what else to say, I think if there is a bug here, it's Google's bug and not an issue with the binding.
So just to be sure (because I'm also getting the map you posted in your screenshot): When you started entering text, all the suggested locations were in Switzerland?
Maybe I'm not sure what you mean exactly.
When i first launch the Intent, I see a list of suggested places "Near" me in the bottom part of the picker.
If I go and start typing in the search box, it doesn't really seem to care about or favour places "Near" me. Perhaps this is what you mean?
As a test, I created the same code in a java Android app and I see the exact same behaviour. I get nearby suggestions on the main picker screen, and when I go to search, it doesn't prioritize places near me - for example if I type 'c' I see California, Colorado, Chicago, Mexico City as items in the list. As far as I can tell, the Search box is not meant (at least on Android) to prioritize based on your location.
Again, the Xamarin and Java Android apps are working identically in this respect for me.
This is super weird - why would Google implement something like this, when the auto completion API also expects the same bounds parameter as the actual map? It's working as suspected on iOS (see my initial screnshot). Also, there's no posts about this on the net, so I'm still thinking something's wrong. After all, the search textbox is useless like this. Did you use my key for your Android Java sample by any chance?
I tried my own API key as well as yours in the java android project.
Sorry but I think this is how the library works. In any case I'm quite confident if there is an issue it doesn't have anything to do with the binding since it's exactly the same in a Java app.
Finally, when I search for something specific (let's say Colasanti's which is a location near me), it does show it in the list after I type just "Colas", so it seems like it's doing _some_ sort of intelligent searching near you, just not searching _only_ near you.
I'm going to mark this as resolved for now. If there's any new info you find, please feel free to comment back and we can reopen.
Ok, I'll have to report this with Google then. Would you mind sharing your Java project with me so that I can submit a repro along with the bug report? I don't think they'll be willing to look into my Xamarin implementation :)