Google autocomplete place_changed doesn't trigger on iOS only


#1

Hi everyone! I’m integrated google places autocomplete on ionic2 and it works fine on android and all browsers. However, on iOS device, when I select a suggestion from the autocomplete list, the place_changed event doesn’t seem to fire. I googled and did my research, however, most of them suggested it’s due to touch event and so far this - https://gist.github.com/schoenobates/ef578a02ac8ab6726487 seems to be the only solution.
Unfortunately, it doesn’t seem to do anything in my case. the touchend is attached and does fire but .stopImmediatePropagation() doesn’t seem to do anything regarding triggering place_changed event.

Thanks in advance for any suggestion :slight_smile:


#2

Hey . did you find a solution to this ? and are you able to share your code ? :slight_smile:


#3

Sorry to say but google developers said they won’t fix this bug and they suggested using cordova plugin instead. What I did to work around this is to reverse geocode from the selected entry and get places suggestions from google api. I can’t share the active code but here’s what I followed to get this working - http://stackoverflow.com/a/8157180/1079478
A bit hacky but it works in my case :slight_smile:

And here’s the discussion with google developers - https://code.google.com/p/gmaps-api-issues/issues/detail?id=8838


#4

Indeed it is a bit hacky… Thanks for the links they helped me a lot :slight_smile:


#5

Where you guys able to address the original problem? i.e. click just passes through autocomplete results and place_changed event is never fired on iOS? I am running into this issue and none of the linked resources have led me to a solution.


#6

Same problem here… @mikeapted did you find any solution ?


#7

yes - more of a workaround than a solution - if you use an <input> instead of an <ion-input> place_changed with fire on ios.

@mhartington - Mike can you confirm if this is an issue that ionic are currently looking at?

Many thanks.


#8

Try something like this

pacContainer var = document.getElementsByClassName (‘pac-container’) [0];
var input = document.getElementsByClassName (‘input-searchbox’) [0];

angular.element (pacContainer) .attr (‘data-tap-disabled’, ‘true’);
angular.element (pacContainer) .on (‘click’, function () {
input.blur ();
});

/ ** Pac-container is adhered by google charts * /

angular.element (input) .on (‘blur’, function () {
searchMethod (input.value);
});

/ ** Input-searchbox is the input class that I make to search * /


#9

Having the same issue here. Would be great to hear of a follow up on this, if there’s any.


#10

This problem seems to still persist in ionic 3. Been scouring for a fix or workaround but none seems to be really ideal. Have I missed something perhaps?


#11

Did you resolve this issue???

Thanks a lot


#12

Did you resolve this issue?


#13

The fix is enabling Google Places API for iOS on the google api library


#14

Not working for me!!! It is not the solution


#15

solution