Geolocation service once called during runtime, it takes very long to respond normally, however whenever I go to some other tab or minimize and reopen the window, the geolocation responds way faster

import { Geolocation } from ‘@ionic-native/geolocation/ngx’;
imported this library and then called this following function:

async loadMapJS(i: number) {
this.geolocation.getCurrentPosition().then((resp) => {
const latLng = new google.maps.LatLng(resp.coords.latitude, resp.coords.longitude);
const mapOptions = {
center: latLng,
zoom: 15,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

 // this.getAddressFromCoordsJS(resp.coords.latitude, resp.coords.longitude);

  this.map = new google.maps.Map(this.mapElement.nativeElement, mapOptions);
  let marker =  new google.maps.Marker();
  // This line gets the coordinates of the clicked location
  google.maps.event.addListener(this.map, 'click', this.func = (event) => {
    marker.setMap(null);
    marker = new google.maps.Marker({
      position: {lat: event.latLng.lat() , lng: event.latLng.lng()},
      map: this.map,
      title: 'Your teaching location set here',
      snippet: 'Click on map to change location',
    });
    marker.setMap(this.map);
    this.classesArray[i].locationLatitude = event.latLng.lat();
    this.classesArray[i].locationLongitude = event.latLng.lng();
  });
}).catch((error) => {
  console.log('Error getting location', error);
});

}

If I call this function in constructor, it works immediately. But if I call this from button during runtime, geolocation takes too long, maybe few minutes to fireup. But if I go to some other tab and come back or minimize and reopen, it hits almost immediately. Can you suggest something for this?