Android: Geolocation: timeout error


#1

Hi everybody,

Ok, this topic is opened again and again. But… I’m using leaflet. With this code:

this.map.locate({
			setView: true,
			maxZoom: 10,
			timeout: 20000
		}).on('locationfound', (e) => {
			let markerGroup = leaflet.featureGroup();
		      let marker: any = leaflet.marker([e.latitude, e.longitude]).on('click', () => {
		        alert('Marker clicked');
		      });
		      markerGroup.addLayer(marker);
		      this.map.addLayer(markerGroup);
		}).on('locationerror', (err) => {
		    alert(err.message);
		})

I always obtain a timeout error. Permission are allowed on my Android for the position. I read a lot of topics about this problem with many many variations. One issue could be from Cordova and using Capacitor was the solution.

Someone have any idea without using Capacitor ?


#3

<plugin name="cordova-plugin-geolocation" spec="^5.0.0">