~dpm/+junk/navigator

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
    "version": "0.3.12",
    "name": "org.apache.cordova.geolocation",
    "cordova_name": "Geolocation",
    "description": "Cordova Geolocation Plugin",
    "license": "Apache 2.0",
    "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-geolocation.git",
    "issue": "https://issues.apache.org/jira/browse/CB/component/12320638",
    "keywords": [
        "cordova",
        "geolocation"
    ],
    "platforms": [
        "android",
        "amazon-fireos",
        "ios",
        "blackberry10",
        "ubuntu",
        "wp7",
        "wp8",
        "windows8",
        "windows",
        "firefoxos"
    ],
    "engines": [],
    "englishdoc": "<!---\n    Licensed to the Apache Software Foundation (ASF) under one\n    or more contributor license agreements.  See the NOTICE file\n    distributed with this work for additional information\n    regarding copyright ownership.  The ASF licenses this file\n    to you under the Apache License, Version 2.0 (the\n    \"License\"); you may not use this file except in compliance\n    with the License.  You may obtain a copy of the License at\n\n      http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing,\n    software distributed under the License is distributed on an\n    \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n    KIND, either express or implied.  See the License for the\n    specific language governing permissions and limitations\n    under the License.\n-->\n\n# org.apache.cordova.geolocation\n\nThis plugin provides information about the device's location, such as\nlatitude and longitude. Common sources of location information include\nGlobal Positioning System (GPS) and location inferred from network\nsignals such as IP address, RFID, WiFi and Bluetooth MAC addresses,\nand GSM/CDMA cell IDs. There is no guarantee that the API returns the\ndevice's actual location.\n\nThis API is based on the\n[W3C Geolocation API Specification](http://dev.w3.org/geo/api/spec-source.html),\nand only executes on devices that don't already provide an implementation.\n\n__WARNING__: Collection and use of geolocation data\nraises important privacy issues.  Your app's privacy policy should\ndiscuss how the app uses geolocation data, whether it is shared with\nany other parties, and the level of precision of the data (for\nexample, coarse, fine, ZIP code level, etc.).  Geolocation data is\ngenerally considered sensitive because it can reveal user's\nwhereabouts and, if stored, the history of their travels.\nTherefore, in addition to the app's privacy policy, you should\nstrongly consider providing a just-in-time notice before the app\naccesses geolocation data (if the device operating system doesn't do\nso already).  That notice should provide the same information noted\nabove, as well as obtaining the user's permission (e.g., by presenting\nchoices for __OK__ and __No Thanks__).  For more information, please\nsee the Privacy Guide.\n\nThis plugin defines a global `navigator.geolocation` object (for platforms\nwhere it is otherwise missing).\n\nAlthough the object is in the global scope, features provided by this plugin\nare not available until after the `deviceready` event.\n\n    document.addEventListener(\"deviceready\", onDeviceReady, false);\n    function onDeviceReady() {\n        console.log(\"navigator.geolocation works well\");\n    }\n\n## Installation\n\n    cordova plugin add org.apache.cordova.geolocation\n\n## Supported Platforms\n\n- Amazon Fire OS\n- Android\n- BlackBerry 10\n- Firefox OS\n- iOS\n- Tizen\n- Windows Phone 7 and 8\n- Windows 8\n\n## Methods\n\n- navigator.geolocation.getCurrentPosition\n- navigator.geolocation.watchPosition\n- navigator.geolocation.clearWatch\n\n## Objects (Read-Only)\n\n- Position\n- PositionError\n- Coordinates\n\n## navigator.geolocation.getCurrentPosition\n\nReturns the device's current position to the `geolocationSuccess`\ncallback with a `Position` object as the parameter.  If there is an\nerror, the `geolocationError` callback is passed a\n`PositionError` object.\n\n    navigator.geolocation.getCurrentPosition(geolocationSuccess,\n                                             [geolocationError],\n                                             [geolocationOptions]);\n\n### Parameters\n\n- __geolocationSuccess__: The callback that is passed the current position.\n\n- __geolocationError__: _(Optional)_ The callback that executes if an error occurs.\n\n- __geolocationOptions__: _(Optional)_ The geolocation options.\n\n\n### Example\n\n    // onSuccess Callback\n    // This method accepts a Position object, which contains the\n    // current GPS coordinates\n    //\n    var onSuccess = function(position) {\n        alert('Latitude: '          + position.coords.latitude          + '\\n' +\n              'Longitude: '         + position.coords.longitude         + '\\n' +\n              'Altitude: '          + position.coords.altitude          + '\\n' +\n              'Accuracy: '          + position.coords.accuracy          + '\\n' +\n              'Altitude Accuracy: ' + position.coords.altitudeAccuracy  + '\\n' +\n              'Heading: '           + position.coords.heading           + '\\n' +\n              'Speed: '             + position.coords.speed             + '\\n' +\n              'Timestamp: '         + position.timestamp                + '\\n');\n    };\n\n    // onError Callback receives a PositionError object\n    //\n    function onError(error) {\n        alert('code: '    + error.code    + '\\n' +\n              'message: ' + error.message + '\\n');\n    }\n\n    navigator.geolocation.getCurrentPosition(onSuccess, onError);\n\n## navigator.geolocation.watchPosition\n\nReturns the device's current position when a change in position is detected.\nWhen the device retrieves a new location, the `geolocationSuccess`\ncallback executes with a `Position` object as the parameter.  If\nthere is an error, the `geolocationError` callback executes with a\n`PositionError` object as the parameter.\n\n    var watchId = navigator.geolocation.watchPosition(geolocationSuccess,\n                                                      [geolocationError],\n                                                      [geolocationOptions]);\n\n### Parameters\n\n- __geolocationSuccess__: The callback that is passed the current position.\n\n- __geolocationError__: (Optional) The callback that executes if an error occurs.\n\n- __geolocationOptions__: (Optional) The geolocation options.\n\n### Returns\n\n- __String__: returns a watch id that references the watch position interval. The watch id should be used with `navigator.geolocation.clearWatch` to stop watching for changes in position.\n\n### Example\n\n    // onSuccess Callback\n    //   This method accepts a `Position` object, which contains\n    //   the current GPS coordinates\n    //\n    function onSuccess(position) {\n        var element = document.getElementById('geolocation');\n        element.innerHTML = 'Latitude: '  + position.coords.latitude      + '<br />' +\n                            'Longitude: ' + position.coords.longitude     + '<br />' +\n                            '<hr />'      + element.innerHTML;\n    }\n\n    // onError Callback receives a PositionError object\n    //\n    function onError(error) {\n        alert('code: '    + error.code    + '\\n' +\n              'message: ' + error.message + '\\n');\n    }\n\n    // Options: throw an error if no update is received every 30 seconds.\n    //\n    var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 });\n\n\n## geolocationOptions\n\nOptional parameters to customize the retrieval of the geolocation\n`Position`.\n\n    { maximumAge: 3000, timeout: 5000, enableHighAccuracy: true };\n\n### Options\n\n- __enableHighAccuracy__: Provides a hint that the application needs the best possible results. By default, the device attempts to retrieve a `Position` using network-based methods. Setting this property to `true` tells the framework to use more accurate methods, such as satellite positioning. _(Boolean)_\n\n- __timeout__: The maximum length of time (milliseconds) that is allowed to pass from the call to `navigator.geolocation.getCurrentPosition` or `geolocation.watchPosition` until the corresponding `geolocationSuccess` callback executes. If the `geolocationSuccess` callback is not invoked within this time, the `geolocationError` callback is passed a `PositionError.TIMEOUT` error code. (Note that when used in conjunction with `geolocation.watchPosition`, the `geolocationError` callback could be called on an interval every `timeout` milliseconds!) _(Number)_\n\n- __maximumAge__: Accept a cached position whose age is no greater than the specified time in milliseconds. _(Number)_\n\n### Android Quirks\n\nAndroid 2.x emulators do not return a geolocation result unless the `enableHighAccuracy` option is set to `true`.\n\n## navigator.geolocation.clearWatch\n\nStop watching for changes to the device's location referenced by the\n`watchID` parameter.\n\n    navigator.geolocation.clearWatch(watchID);\n\n### Parameters\n\n- __watchID__: The id of the `watchPosition` interval to clear. (String)\n\n### Example\n\n    // Options: watch for changes in position, and use the most\n    // accurate position acquisition method available.\n    //\n    var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true });\n\n    // ...later on...\n\n    navigator.geolocation.clearWatch(watchID);\n\n## Position\n\nContains `Position` coordinates and timestamp, created by the geolocation API.\n\n### Properties\n\n- __coords__: A set of geographic coordinates. _(Coordinates)_\n\n- __timestamp__: Creation timestamp for `coords`. _(Date)_\n\n## Coordinates\n\nA `Coordinates` object is attached to a `Position` object that is\navailable to callback functions in requests for the current position.\nIt contains a set of properties that describe the geographic coordinates of a position.\n\n### Properties\n\n* __latitude__: Latitude in decimal degrees. _(Number)_\n\n* __longitude__: Longitude in decimal degrees. _(Number)_\n\n* __altitude__: Height of the position in meters above the ellipsoid. _(Number)_\n\n* __accuracy__: Accuracy level of the latitude and longitude coordinates in meters. _(Number)_\n\n* __altitudeAccuracy__: Accuracy level of the altitude coordinate in meters. _(Number)_\n\n* __heading__: Direction of travel, specified in degrees counting clockwise relative to the true north. _(Number)_\n\n* __speed__: Current ground speed of the device, specified in meters per second. _(Number)_\n\n###  Amazon Fire OS Quirks\n\n__altitudeAccuracy__: Not supported by Android devices, returning `null`.\n\n### Android Quirks\n\n__altitudeAccuracy__: Not supported by Android devices, returning `null`.\n\n## PositionError\n\nThe `PositionError` object is passed to the `geolocationError`\ncallback function when an error occurs with navigator.geolocation.\n\n### Properties\n\n- __code__: One of the predefined error codes listed below.\n\n- __message__: Error message describing the details of the error encountered.\n\n### Constants\n\n- `PositionError.PERMISSION_DENIED`\n  - Returned when users do not allow the app to retrieve position information. This is dependent on the platform.\n- `PositionError.POSITION_UNAVAILABLE`\n  - Returned when the device is unable to retrieve a position. In general, this means the device is not connected to a network or can't get a satellite fix.\n- `PositionError.TIMEOUT`\n  - Returned when the device is unable to retrieve a position within the time specified by the `timeout` included in `geolocationOptions`. When used with `navigator.geolocation.watchPosition`, this error could be repeatedly passed to the `geolocationError` callback every `timeout` milliseconds.\n"
}