Capacitor / @googlemaps/js-api-loader: Can't import library via loader

Discussão em 'Angular' iniciado por RattleStork.org, Janeiro 28, 2025.

  1. I am building an Angular + Capacitor app and want to use the Google Places API along with the Geocoding API. I have configured the API key in the Cloud Console (with no restrictions on the key) and am using the @googlemaps/js-api-loader package like this:

    const loader = await new Loader({
    apiKey: environment.googlePlacesApiKeyWeb,
    version: "quarterly",
    });


    // loader.importLibrary("places") does not return on ios and android
    const { AutocompleteService } = await loader.importLibrary("places");



    Everything works fine on the web, but the same code doesn't work on Android or iOS.

    Does anyone have any ideas on how to debug this further, or has anyone already solved this problem?

    Things I have already tried:

    • using the old load() method of the Loader class
    • async/await implementation
    • Promise-based loading
    • Callbacks

    Any help would be greatly appreciated!

    Continue reading...

Compartilhe esta Página