Search code examples
angularobjectionic-frameworkgeolocationionic4

Google maps and geolocation with Ionic: Object is not a function


I am currently working on a project for my studies where I need to copy a sports application like Runastic with Ionic 4 - Angular

For that I try to add to my application a map (Google maps), as well as a geolocation system.

For the integration of google maps I followed this tutorial: https://ramsatt.com/2019/02/19/ionic-4 - google-map - part-1 - simple-map/

For the moment it works but I'm blocking this part of the tutorial: http://ramsatt.com/2019/05/02/ionic-4 - google-map - part-1 - geo-location/

When I go to the page where my map is located I encounter this error:

Error: Uncaught (in promise): TypeError: Object(...) is not a function TypeError: Object(...) is not a function at Geolocation.Array.concat.Geolocation.getCurrentPosition (http://localhost:8100/build/0.js:9874:143) at GeolocationPage.Array.concat.GeolocationPage.ngAfterViewInit

And my system configuration:

Ionic Framework: 3.9.5

Ionic App Scripts: 3.2.2

Angular Core: 5.2.11

Angular Compiler CLI: ^7.2.15

Node: 10.15.2

Thanks for your help.


Solution

  • Problem solved.

    I had created a basic proposed ionic project but the version of ionic used is 3 and not 4....