w3c-geolocation

How to use Async Wait with HTML5 GeoLocation API?

一曲冷凌霜 提交于 2020-07-20 17:15:29
问题 The first method returns promise. getCoordinates() { return new Promise(function(resolve, reject) { navigator.geolocation.getCurrentPosition(resolve, reject); }); } Returns the result of reverseGeoCode method. async getAddress() { await this.getCoordinates().then(position => { let latitude = position.coords.latitude; let longitude = position.coords.longitude; let url = Constants.OSMAP_URL + latitude + "&lon=" + longitude; // Reverse geocoding using OpenStreetMap return this.reverseGeoCode(url

navigator.geolocation.getCurrentPosition() never returns in WebView on Android

喜你入骨 提交于 2020-05-11 03:52:21
问题 I am trying to access the HTML Geolocation API available in Android WebView (using SDK version 24). The main problem is that the call to navigator.geolocation.getCurrentPosition() in JavaScript never returns (neither with an error, nor with position data), while on application side I check for permissions and properly pass them to WebView using android.webkit.GeolocationPermissions.Callback class. UPDATE: Just to clarify here, by "never returns" I mean that none of the too supplied callbacks

HTML5 geolocation won't work in Firefox, Chrome and Chromium

☆樱花仙子☆ 提交于 2020-01-14 17:53:47
问题 I'm trying to use the HTML5 geolocation API; but I have problems to make it work on Firefox Chrome and Chromium : init(); function init() {; // Get the current location getPosition(); } function getPosition() { navigator.geolocation.getCurrentPosition(success, fail,{ enableHighAccuracy:true, timeout:10000, maximumAge:Infinity }); } function success(position) { alert("Your latitude: " + position.coords.latitude + "longitude: " + position.coords.longitude); } function fail(e) { alert("Your

iOS 6 breaks GeoLocation web app

喜夏-厌秋 提交于 2019-12-24 09:00:07
问题 We have an HTML5 app that uses web sql, offline functionalitiy and the geolocation API with the enableHighAccuracy option set true. Since iOS6 position.coords.accuracy often reports high values (100m+) even after a couple minutes warm up outdoors whereas iOS5 went to and stayed at 5m accuracy fairly quickly the same on iPhone 4S, iPad 3. One workaround is to kill all apps then run the Apple map app, press the current location button and then start the HTML5 web app in which case things work

How to determine an Android device's current country location regardless of user location settings?

一世执手 提交于 2019-12-22 05:07:42
问题 I need to determine the country (iso3) the device is in even if the user's device has GPS turned off and does not allow apps to access it's location. I also need to account for tablets that have no sim card and thus cannot use telephonyManager. For this reason I don't believe I can use the location manager (also because of these reasons: LocationManager requestLocationUpdates doesn't work) The approach I am thinking I will need is to make a simple HTTP request to a third party ip location api

Check if Geolocation was allowed and get Lat Lon

て烟熏妆下的殇ゞ 提交于 2019-12-18 19:49:12
问题 I'm building a small script that clients will install on their page. Geolocation is not necessary for it, however if it exists it would be nice to have. Is there a way for me to check if the clients page has requested geolocation information and if the user selected allow get the lat & lon without creating another prompt? 回答1: It isn't possible with the geolocation API but it is possible with the new permission API This code is useful if you want to try to receive the coordinates but don't

I am getting (lat,long) coordinates in phonegap geolocation without using internet or GPS ?

我是研究僧i 提交于 2019-12-12 12:15:08
问题 When i tried out a sample program in phonegap geolocation. I am getting the latitude and longitude of my current location without internet or GPS in my samsung pop. I don't know how it is getting the coordinates, altitude and timestamp of the current location when the wifi and gps in my device is DISABLED. Kindly help me.. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org /TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html;

PhoneGap Geolocation is blocked in iOS10

陌路散爱 提交于 2019-12-11 01:22:11
问题 My Phonegap app leverages the (Cordova 3.8) webviews 'W3C Geolocation API'. Since upgrading from iOS 9.x to iOS 10 (beta) however, using navigator.geolocation.getCurrentPosition(...) now returns an error: Access to geolocation was blocked over insecure connection to http://localhost. ERROR(2): Origin does not have permission to use Geolocation service I do not currently use the Cordova Whitelist Plugin. Would using that help or is there a simpler fix? 回答1: I added the geolocation plugin

geoLocation enabling without page-refresh?

余生颓废 提交于 2019-12-10 22:07:43
问题 Currently, we have to refresh the web-page (actually PhoneGap app) if the GPS was off and (after notifying the user) then turned-on. How can we update the GeoLocation status without the need to refresh the page/app ? 回答1: Why not simply use a setInterval to check for support every few seconds? 回答2: Hopefully this helps someone else out. I had the same issues with trying to load the geoLocation over Google Maps API in a multi page phonegap+JQM app. A setInterval/setTimer did not work as well.

react native ios: geoloc has poor accuracy by default

和自甴很熟 提交于 2019-12-10 16:38:21
问题 I'm implementing a fitness tracker with navigator.geolocation.watchPosition and getCurrentPosition . It works fine on android and on ios emulator, have 5/10m accuracy, but on iphone 5s, I have a terrible accuracy (50/65). I found out that when I was running an existing fitness tracker at the same time (strava) on ios, suddenly my app was retrieving GPS coordinates with very good accuracy. So clearly I must be missing some configuration because by default my app does not use high accuracy on