小编Zer*_*rok的帖子

Ionic Geolocation 需要花费太多时间才能获得位置

我正在测试一个 Ionic 3.4 应用程序,它曾经在浏览器中完美运行。安装一些 Cordova 插件(有些可能仍然丢失)后,我安装了最新的 Android SDK 和 4.0(这是我想要的 SDK 级别)。

制作了一个 JS 谷歌地图页面,它从我的数据库加载一些组件,在浏览器中工作得非常好。但是......在手机(小米5s,Android 6.0.1)中,它需要GPS才能工作,加载当前位置需要大约2-3分钟。毫不夸张地说:2-3分钟。

问题似乎出在这一行:

this.geolocation.getCurrentPosition().then((position) => {
Run Code Online (Sandbox Code Playgroud)

在那之后,它会穿过这条线并指向我的确切位置。这很好用,但不应该花那么多时间。

这是我的 package.json:

{
    "name": "MyApp",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.0.0",
        "@angular/compiler": "4.0.0",
        "@angular/compiler-cli": "4.0.0",
        "@angular/core": "4.0.0",
        "@angular/forms": "4.0.0",
        "@angular/http": "4.0.0",
        "@angular/platform-browser": "4.0.0",
        "@angular/platform-browser-dynamic": "4.0.0",
        "@ionic-native/core": "^3.6.0",
        "@ionic-native/geolocation": "^3.8.0",
        "@ionic-native/splash-screen": "^3.5.0",
        "@ionic-native/status-bar": "3.4.2",
        "@ionic/storage": "2.0.1",
        "cordova-android": "^6.2.3", …
Run Code Online (Sandbox Code Playgroud)

android cordova ionic-framework

5
推荐指数
0
解决办法
1781
查看次数

标签 统计

android ×1

cordova ×1

ionic-framework ×1