[SOLVED] Google is not defined in google places autocomplete while testing on android device


#1

I am making places autocomplete and it working properly in browser but gives this error when run in android device. I checked one of the posts from @richardshergold and did all the things mentioned in it but still it doesn’t work. Any help will be appreciated.

getPlace() {
    let input_from = <HTMLInputElement>document.getElementById("places");
    console.log(input_from);
    let options = {
        types: [],
        componentRestrictions: { country: "IN" }
    };

    let autocomplete = new google.maps.places.Autocomplete(input_from, options);

    google.maps.event.addListener(autocomplete, 'place_changed', function () {
        let place = autocomplete.getPlace();
        //let geometry = place.geometry;
        console.log(place);
    });
}

I have included the link for the google maps api at the top of all the scripts.