{"action":"created","issue":{"url":"https://api.github.com/repos/NativeScript/docs/issues/197","labels_url":"https://api.github.com/repos/NativeScript/docs/issues/197/labels{/name}","comments_url":"https://api.github.com/repos/NativeScript/docs/issues/197/comments","events_url":"https://api.github.com/repos/NativeScript/docs/issues/197/events","html_url":"https://github.com/NativeScript/docs/issues/197","id":120885939,"number":197,"title":"\"Requesting permission to use location service\" javascript snippet is not valid, page unclear.","user":{"login":"danielrob","id":5865302,"avatar_url":"https://avatars.githubusercontent.com/u/5865302?v=3","gravatar_id":"","url":"https://api.github.com/users/danielrob","html_url":"https://github.com/danielrob","followers_url":"https://api.github.com/users/danielrob/followers","following_url":"https://api.github.com/users/danielrob/following{/other_user}","gists_url":"https://api.github.com/users/danielrob/gists{/gist_id}","starred_url":"https://api.github.com/users/danielrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielrob/subscriptions","organizations_url":"https://api.github.com/users/danielrob/orgs","repos_url":"https://api.github.com/users/danielrob/repos","events_url":"https://api.github.com/users/danielrob/events{/privacy}","received_events_url":"https://api.github.com/users/danielrob/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-12-07T22:42:50Z","updated_at":"2015-12-09T14:05:33Z","closed_at":null,"body":"[The location documentation](https://github.com/NativeScript/docs/blob/production/location.md#request-a-permission-to-use-location-service) has a javascript snippet which is mostly typescript - it crashes the ios emulator: \r\n\r\n```\r\nvar buttonModule = require(\"ui/button\");\r\nvar appModule = require(\"application\");\r\nvar platformModule = require(\"platform\");\r\n\r\nvar onRequestButtonTap = function(args: observable.EventData) {\r\n    var button = <buttonModule.Button>(args.object);\r\n    if (button.android) {\r\n        console.log(\"Application run on Android\");\r\n        (<android.app.Activity>appModule.android.currentContext).startActivityForResult(new android.content.Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);\r\n    }\r\n    else if (button.ios) {\r\n        console.log(\"Application run on iOS\");\r\n        if (platformModule.device.osVersion.indexOf(\"8\") === 0) {\r\n            console.log(\"iOS version is greater or equal to 8.0\");\r\n            var iosLocationManager = CLLocationManager.alloc().init();\r\n            iosLocationManager.requestWhenInUseAuthorization();\r\n        }\r\n    }\r\n```\r\n\r\n---\r\n\r\nFurther to this, this whole section is not as clear as it might be - it took me some time to decipher. I think it could be more obvious with an end-to-end example. The following is a suggested structure for the page:\r\n\r\n----\r\n\r\n## Configure a location service for the application\r\nTo enable location services it is first required to configure a location service in the respective application bundles: \r\n\r\nFor an IOS 8.0+ project:   \r\nAdd one of the two following snippets to `<applicationName>-Info.plist` depending on your business needs: \r\n\r\n    <key>NSLocationAlwaysUsageDescription</key>\r\n    <string>Your message goes here</string>\r\n\r\n    <key>NSLocationWhenInUseUsageDescription</key>\r\n    <string>Your message goes here</string>\r\n\r\nIn an Android project:   \r\n  \r\n    <android example/instructions>\r\n\r\n## Request permission to use the location service\r\nNext, a request to use the location service is required. Unfortunately... `(section as it stands with corrected javascript snippet above)...`\r\n\r\n## Getting a location\r\n\r\n`\r\nEither point to, or move the` [HOW-TO](https://github.com/NativeScript/docs/blob/production/ApiReference/location/HOW-TO.md) `page to this location in the interests of DRY. The HOW-TO page seems clearer, and contains more information (with less words). `\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/NativeScript/docs/issues/comments/163246972","html_url":"https://github.com/NativeScript/docs/issues/197#issuecomment-163246972","issue_url":"https://api.github.com/repos/NativeScript/docs/issues/197","id":163246972,"user":{"login":"jlooper","id":1450004,"avatar_url":"https://avatars.githubusercontent.com/u/1450004?v=3","gravatar_id":"","url":"https://api.github.com/users/jlooper","html_url":"https://github.com/jlooper","followers_url":"https://api.github.com/users/jlooper/followers","following_url":"https://api.github.com/users/jlooper/following{/other_user}","gists_url":"https://api.github.com/users/jlooper/gists{/gist_id}","starred_url":"https://api.github.com/users/jlooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlooper/subscriptions","organizations_url":"https://api.github.com/users/jlooper/orgs","repos_url":"https://api.github.com/users/jlooper/repos","events_url":"https://api.github.com/users/jlooper/events{/privacy}","received_events_url":"https://api.github.com/users/jlooper/received_events","type":"User","site_admin":false},"created_at":"2015-12-09T14:05:33Z","updated_at":"2015-12-09T14:05:33Z","body":"@N3ll @danielrob wow, I didn't know about this plugin. I'm not sure, however that it covers the same use case. The code I'm referencing above is managing the native popup that appears when you enable location via the Info.plist in iOS, which is more complicated than in Android. In the geolocation plugin, I don't see instructions on how to do that. Is that use case covered? cc @nsndeck "}}