【问题标题】:How to get exact live location of website user?如何获取网站用户的准确实时位置?
【发布时间】:2021-12-31 02:34:57
【问题描述】:

有没有什么方法可以让我获得网站用户的实时确切位置,这样我应该能够看到用户在 50 - 100 平方米的区域内是否可用?

是否可以通过nodeJs,如果没有,那么任何其他方式。

可以通过Android开发吗?

假设我现在可以完全访问用户设备吗?

【问题讨论】:

  • 从网页中,您将使用Gelocation API,但最终用户必须允许权限。通过在网页中运行的 javascript 获取位置后,它可以将其发送到您的服务器。
  • Android 应用可以使用 Android API 来确定用户的位置(Android 应用还必须具有适当的权限才能使用这些 API)。
  • 这个解决方案是否满足我上面提到的要求?
  • 您将不得不研究不同的地理定位 API,看看它们对定位精度的看法,甚至可能在所需的情况下尝试它们。畅通无阻的 GPS 非常准确(10 英尺以下),但并非总是畅通无阻。

标签: android node.js web location web-development-server


【解决方案1】:
navigator.geolocation.watchPosition(res => console.log(res))

output : GeolocationPosition {coords: GeolocationCoordinates, timestamp: 1640926681834}coords: GeolocationCoordinatesaccuracy: 20altitude: nullaltitudeAccuracy: nullheading: nulllatitude: 28.6366846longitude: 77.4627344speed: null[[Prototype]]: GeolocationCoordinatestimestamp: 1640926681834[[Prototype]]: GeolocationPosition

您可以轻松使用此代码,如果您想在实时网站中使用而不是 ssl(https) 并且必须启用位置并且在本地它会正常工作。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-10-10
    • 2012-03-12
    • 1970-01-01
    • 1970-01-01
    • 2012-03-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多