Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于 h5 定位方案 #12

Open
K-Kevin opened this issue Jan 7, 2020 · 0 comments
Open

关于 h5 定位方案 #12

K-Kevin opened this issue Jan 7, 2020 · 0 comments

Comments

@K-Kevin
Copy link
Owner

K-Kevin commented Jan 7, 2020

由于 h5 定位的体验不是很好,为了达到最佳效果,需要进行一些优化。

首先得考虑到 h5 可能运行的环境,可能有以下情况:

  1. App 内嵌
  2. 微信环境
  3. 浏览器

方案

App 内嵌

对于在 App 内的场景,推荐使用 App 提供的原生定位,体验最佳,所以 h5 需要与原生 App 进行交互,交互方法就不多讲,jsBridge 即可。

微信环境

如果在微信环境中,只需要引入 weixin-js-sdk,使用 wx.getLocation 即可。

浏览器环境

对于其他App嵌入或者浏览器,统一经过 h5 定位,为了方便我们可以直接使用高德地图 sdk,高德地图同时也自带 ip 定位,前提是获取定位超时才会使用 ip 定位。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant