Ionic-native: app does not request for location permission

Created on 2 Nov 2017  路  8Comments  路  Source: ionic-team/ionic-native

I'm submitting a ... (check one with "x")
[ x ] bug report
[ ] feature request

Current behavior:
The app does not request for location permission. Tried it with the plugins background geolocation and Location Accuracy.

Expected behavior:
When I start the app I wan't to be asked for permission to give my location or when using the app.

Steps to reproduce:
open the app

Related code:

https://github.com/mbakker96/location-bug
Other information:

package.json info:

{
    "name": "location-app",
    "version": "0.0.1",
    "author": "Ionic Framework",
    "homepage": "http://ionicframework.com/",
    "private": true,
    "scripts": {
        "clean": "ionic-app-scripts clean",
        "build": "ionic-app-scripts build",
        "lint": "ionic-app-scripts lint",
        "ionic:build": "ionic-app-scripts build",
        "ionic:serve": "ionic-app-scripts serve"
    },
    "dependencies": {
        "@angular/common": "4.4.4",
        "@angular/compiler": "4.4.4",
        "@angular/compiler-cli": "4.4.4",
        "@angular/core": "4.4.4",
        "@angular/forms": "4.4.4",
        "@angular/http": "4.4.4",
        "@angular/platform-browser": "4.4.4",
        "@angular/platform-browser-dynamic": "4.4.4",
        "@ionic-native/background-geolocation": "^4.3.3",
        "@ionic-native/core": "4.3.2",
        "@ionic-native/location-accuracy": "^4.3.3",
        "@ionic-native/splash-screen": "4.3.2",
        "@ionic-native/status-bar": "4.3.2",
        "@ionic/storage": "2.0.1",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-device": "^1.1.4",
        "cordova-plugin-ionic-webview": "^1.1.16",
        "cordova-plugin-mauron85-background-geolocation": "^2.3.1",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-whitelist": "^1.3.1",
        "ionic-angular": "3.8.0",
        "ionic-plugin-keyboard": "^2.2.1",
        "ionicons": "3.0.0",
        "rxjs": "5.4.3",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "3.0.1",
        "typescript": "2.3.4"
    },
    "description": "An Ionic project",
    "cordova": {
        "plugins": {
            "cordova-plugin-mauron85-background-geolocation": {},
            "cordova-plugin-device": {},
            "cordova-plugin-ionic-webview": {},
            "cordova-plugin-splashscreen": {},
            "cordova-plugin-whitelist": {},
            "ionic-plugin-keyboard": {},
        },
        "platforms": [
            "ios"
        ]
    }
}

Most helpful comment

You have to add this line of code to your config.xml file

<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
     <string>We want your location! Best regards NSA</string>
</edit-config>

I will add this information to the docs.

All 8 comments

I am also facing the same issue here.

This is also affecting my application

I am also have this problem

Me too

same with me..

Same...

I've just fixed the issue for me using cordova plugin add cordova-plugin-geolocation --save - this saves the plugin into the config.xml, which the native geolocation didn't do? Credit: https://stackoverflow.com/a/39152933/509607

You have to add this line of code to your config.xml file

<edit-config file="*-Info.plist" mode="merge" target="NSLocationWhenInUseUsageDescription">
     <string>We want your location! Best regards NSA</string>
</edit-config>

I will add this information to the docs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

GunaSekhar1 picture GunaSekhar1  路  4Comments

wwallace picture wwallace  路  4Comments

goleary picture goleary  路  3Comments

ghost picture ghost  路  3Comments

JaneDawson picture JaneDawson  路  4Comments