离子地理位置需要太多时间来获得位置

时间:2017-06-19 10:22:34

标签: android cordova ionic-framework

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

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

问题似乎在于这一行:

this.geolocation.getCurrentPosition().then((position) => {

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

这是我的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",
        "cordova-plugin-compat": "^1.0.0",
        "cordova-plugin-console": "^1.0.5",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-geolocation": "^2.4.3",
        "cordova-plugin-googlemaps": "~1.4.0",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "^2.2.1",
        "cordova-plugin-whitelist": "^1.3.1",
        "image-manipulation": "0.0.4",
        "ionic-angular": "3.0.1",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "parse": "^1.9.2",
        "rxjs": "5.1.1",
        "sw-toolbox": "3.4.0",
        "zone.js": "^0.8.4"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^1.3.1",
        "@ionic/cli-plugin-cordova": "1.4.0",
        "@ionic/cli-plugin-ionic-angular": "1.3.1",
        "typescript": "~2.2.1"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-whitelist": {},
            "cordova-plugin-geolocation": {},
            "cordova-plugin-console": {},
            "cordova-plugin-device": {},
            "cordova-plugin-googlemaps": {
                "API_KEY_FOR_ANDROID": "AIzaSyDFX_9vIksX3JMDVjDIRa5bxoioWCW_q4g",
                "API_KEY_FOR_IOS": "AIzaSyDFX_9vIksX3JMDVjDIRa5bxoioWCW_q4g"
            },
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-statusbar": {},
            "ionic-plugin-keyboard": {}
        },
        "platforms": [
            "android"
        ]
    }
}

这里有什么问题?

谢谢!

编辑:好的,这个片段在三星S5上运行良好,但它在我的小米mi5中不起作用......任何想法?

0 个答案:

没有答案