Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 65B04200B3C for ; Wed, 13 Jul 2016 13:51:31 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 642AC160A57; Wed, 13 Jul 2016 11:51:31 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 46267160A7C for ; Wed, 13 Jul 2016 13:51:29 +0200 (CEST) Received: (qmail 99936 invoked by uid 500); 13 Jul 2016 11:51:28 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 99927 invoked by uid 99); 13 Jul 2016 11:51:28 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Jul 2016 11:51:28 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id D5BB21A5E08 for ; Wed, 13 Jul 2016 11:51:27 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.574 X-Spam-Level: X-Spam-Status: No, score=0.574 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_HUGEIMGSRC=0.2, KAM_LAZY_DOMAIN_SECURITY=1, RP_MATCHES_RCVD=-1.426] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id ZQ-L4L8sO1-8 for ; Wed, 13 Jul 2016 11:51:16 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id E5E5B60D59 for ; Wed, 13 Jul 2016 11:51:14 +0000 (UTC) Received: from svn01-us-west.apache.org (svn.apache.org [10.41.0.6]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A9B8AE63EB for ; Wed, 13 Jul 2016 11:51:12 +0000 (UTC) Received: from svn01-us-west.apache.org (localhost [127.0.0.1]) by svn01-us-west.apache.org (ASF Mail Server at svn01-us-west.apache.org) with ESMTP id 8CF763A0051 for ; Wed, 13 Jul 2016 11:51:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1752402 [13/17] - in /cordova/site/public: ./ announcements/2016/07/02/ announcements/2016/07/11/ blog/ docs/en/dev/ docs/en/dev/config_ref/ docs/en/dev/cordova/events/ docs/en/dev/cordova/storage/ docs/en/dev/guide/appdev/hooks/ docs/en/d... Date: Wed, 13 Jul 2016 11:51:11 -0000 To: commits@cordova.apache.org From: an-selm@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20160713115112.8CF763A0051@svn01-us-west.apache.org> archived-at: Wed, 13 Jul 2016 11:51:31 -0000 Modified: cordova/site/public/docs/en/dev/reference/cordova-plugin-geolocation/index.html URL: http://svn.apache.org/viewvc/cordova/site/public/docs/en/dev/reference/cordova-plugin-geolocation/index.html?rev=1752402&r1=1752401&r2=1752402&view=diff ============================================================================== --- cordova/site/public/docs/en/dev/reference/cordova-plugin-geolocation/index.html (original) +++ cordova/site/public/docs/en/dev/reference/cordova-plugin-geolocation/index.html Wed Jul 13 11:51:10 2016 @@ -6,12 +6,12 @@ - + - cordova-plugin-geolocation - Apache Cordova + Geolocation - Apache Cordova @@ -732,7 +732,7 @@
  • - cordova-plugin-battery-status + Battery Status @@ -747,7 +747,7 @@
  • - cordova-plugin-camera + Camera @@ -762,7 +762,7 @@
  • - cordova-plugin-console + Console @@ -777,7 +777,7 @@
  • - cordova-plugin-contacts + Contacts @@ -792,7 +792,7 @@
  • - cordova-plugin-device + Device @@ -807,7 +807,7 @@
  • - cordova-plugin-device-motion + Device Motion @@ -822,7 +822,7 @@
  • - cordova-plugin-device-orientation + Device Orientation @@ -837,7 +837,7 @@
  • - cordova-plugin-dialogs + Dialogs @@ -852,7 +852,7 @@
  • - cordova-plugin-file + File @@ -867,7 +867,7 @@
  • - cordova-plugin-file-transfer + File Transfer @@ -882,7 +882,7 @@
  • - cordova-plugin-geolocation + Geolocation @@ -899,7 +899,7 @@
  • - cordova-plugin-globalization + Globalization @@ -914,7 +914,7 @@
  • - cordova-plugin-inappbrowser + Inappbrowser @@ -929,7 +929,7 @@
  • - cordova-plugin-media + Media @@ -944,7 +944,7 @@
  • - cordova-plugin-media-capture + Media Capture @@ -959,7 +959,7 @@
  • - cordova-plugin-network-information + Network Information @@ -974,7 +974,7 @@
  • - cordova-plugin-splashscreen + Splashscreen @@ -989,7 +989,7 @@
  • - cordova-plugin-vibration + Vibration @@ -1004,7 +1004,7 @@
  • - cordova-plugin-statusbar + Statusbar @@ -1019,7 +1019,7 @@
  • - cordova-plugin-whitelist + Whitelist @@ -1034,7 +1034,7 @@
  • - cordova-plugin-legacy-whitelist + Legacy Whitelist @@ -1388,7 +1388,7 @@
  • - cordova-plugin-battery-status + Battery Status
  • @@ -1397,7 +1397,7 @@
  • - cordova-plugin-camera + Camera
  • @@ -1406,7 +1406,7 @@
  • - cordova-plugin-console + Console
  • @@ -1415,7 +1415,7 @@
  • - cordova-plugin-contacts + Contacts
  • @@ -1424,7 +1424,7 @@
  • - cordova-plugin-device + Device
  • @@ -1433,7 +1433,7 @@
  • - cordova-plugin-device-motion + Device Motion
  • @@ -1442,7 +1442,7 @@
  • - cordova-plugin-device-orientation + Device Orientation
  • @@ -1451,7 +1451,7 @@
  • - cordova-plugin-dialogs + Dialogs
  • @@ -1460,7 +1460,7 @@
  • - cordova-plugin-file + File
  • @@ -1469,7 +1469,7 @@
  • - cordova-plugin-file-transfer + File Transfer
  • @@ -1478,7 +1478,7 @@
  • - cordova-plugin-geolocation + Geolocation
  • @@ -1487,7 +1487,7 @@
  • - cordova-plugin-globalization + Globalization
  • @@ -1496,7 +1496,7 @@
  • - cordova-plugin-inappbrowser + Inappbrowser
  • @@ -1505,7 +1505,7 @@
  • - cordova-plugin-media + Media
  • @@ -1514,7 +1514,7 @@
  • - cordova-plugin-media-capture + Media Capture
  • @@ -1523,7 +1523,7 @@
  • - cordova-plugin-network-information + Network Information
  • @@ -1532,7 +1532,7 @@
  • - cordova-plugin-splashscreen + Splashscreen
  • @@ -1541,7 +1541,7 @@
  • - cordova-plugin-vibration + Vibration
  • @@ -1550,7 +1550,7 @@
  • - cordova-plugin-statusbar + Statusbar
  • @@ -1559,7 +1559,7 @@
  • - cordova-plugin-whitelist + Whitelist
  • @@ -1568,7 +1568,7 @@
  • - cordova-plugin-legacy-whitelist + Legacy Whitelist
  • @@ -2688,17 +2688,41 @@ # under the License. --> -

    Build Status

    + + + + + + + + + + + + + + + + + + +
    AndroidiOSWindows 8.1 StoreWindows 8.1 PhoneWindows 10 StoreTravis CI
    Build StatusBuild StatusBuild StatusBuild StatusBuild StatusBuild Status

    cordova-plugin-geolocation

    This plugin provides information about the device's location, such as -latitude and longitude. Common sources of location information include +latitude and longitude.

    + +

    Common sources of location information include Global Positioning System (GPS) and location inferred from network signals such as IP address, RFID, WiFi and Bluetooth MAC addresses, and GSM/CDMA cell IDs. There is no guarantee that the API returns the device's actual location.

    +
    +

    To get a few ideas, check out the sample at the bottom of this page or go straight to the reference content.

    +
    +

    This API is based on the W3C Geolocation API Specification, and only executes on devices that don't already provide an implementation.

    @@ -2723,11 +2747,15 @@ where it is otherwise missing).

    Although the object is in the global scope, features provided by this plugin are not available until after the deviceready event.

    -
    document.addEventListener("deviceready", onDeviceReady, false);
    -function onDeviceReady() {
    -    console.log("navigator.geolocation works well");
    -}
    +
    
    +    document.addEventListener("deviceready", onDeviceReady, false);
    +    function onDeviceReady() {
    +        console.log("navigator.geolocation works well");
    +    }
    +
     
    +

    Reference

    +

    Installation

    This requires cordova 5.0+ ( current stable 1.0.0 )

    @@ -2787,29 +2815,31 @@ error, the geolocationError

    Example

    -
    // onSuccess Callback
    -// This method accepts a Position object, which contains the
    -// current GPS coordinates
    -//
    -var onSuccess = function(position) {
    -    alert('Latitude: '          + position.coords.latitude          + '\n' +
    -          'Longitude: '         + position.coords.longitude         + '\n' +
    -          'Altitude: '          + position.coords.altitude          + '\n' +
    -          'Accuracy: '          + position.coords.accuracy          + '\n' +
    -          'Altitude Accuracy: ' + position.coords.altitudeAccuracy  + '\n' +
    -          'Heading: '           + position.coords.heading           + '\n' +
    -          'Speed: '             + position.coords.speed             + '\n' +
    -          'Timestamp: '         + position.timestamp                + '\n');
    -};
    -
    -// onError Callback receives a PositionError object
    -//
    -function onError(error) {
    -    alert('code: '    + error.code    + '\n' +
    -          'message: ' + error.message + '\n');
    -}
    +
    
    +    // onSuccess Callback
    +    // This method accepts a Position object, which contains the
    +    // current GPS coordinates
    +    //
    +    var onSuccess = function(position) {
    +        alert('Latitude: '          + position.coords.latitude          + '\n' +
    +              'Longitude: '         + position.coords.longitude         + '\n' +
    +              'Altitude: '          + position.coords.altitude          + '\n' +
    +              'Accuracy: '          + position.coords.accuracy          + '\n' +
    +              'Altitude Accuracy: ' + position.coords.altitudeAccuracy  + '\n' +
    +              'Heading: '           + position.coords.heading           + '\n' +
    +              'Speed: '             + position.coords.speed             + '\n' +
    +              'Timestamp: '         + position.timestamp                + '\n');
    +    };
    +
    +    // onError Callback receives a PositionError object
    +    //
    +    function onError(error) {
    +        alert('code: '    + error.code    + '\n' +
    +              'message: ' + error.message + '\n');
    +    }
    +
    +    navigator.geolocation.getCurrentPosition(onSuccess, onError);
     
    -navigator.geolocation.getCurrentPosition(onSuccess, onError);
     

    Android Quirks

    @@ -2842,27 +2872,29 @@ there is an error, the geolocation

    Example

    -
    // onSuccess Callback
    -//   This method accepts a `Position` object, which contains
    -//   the current GPS coordinates
    -//
    -function onSuccess(position) {
    -    var element = document.getElementById('geolocation');
    -    element.innerHTML = 'Latitude: '  + position.coords.latitude      + '<br />' +
    -                        'Longitude: ' + position.coords.longitude     + '<br />' +
    -                        '<hr />'      + element.innerHTML;
    -}
    -
    -// onError Callback receives a PositionError object
    -//
    -function onError(error) {
    -    alert('code: '    + error.code    + '\n' +
    -          'message: ' + error.message + '\n');
    -}
    -
    -// Options: throw an error if no update is received every 30 seconds.
    -//
    -var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 });
    +
    
    +    // onSuccess Callback
    +    //   This method accepts a `Position` object, which contains
    +    //   the current GPS coordinates
    +    //
    +    function onSuccess(position) {
    +        var element = document.getElementById('geolocation');
    +        element.innerHTML = 'Latitude: '  + position.coords.latitude      + '<br />' +
    +                            'Longitude: ' + position.coords.longitude     + '<br />' +
    +                            '<hr />'      + element.innerHTML;
    +    }
    +
    +    // onError Callback receives a PositionError object
    +    //
    +    function onError(error) {
    +        alert('code: '    + error.code    + '\n' +
    +              'message: ' + error.message + '\n');
    +    }
    +
    +    // Options: throw an error if no update is received every 30 seconds.
    +    //
    +    var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { timeout: 30000 });
    +
     

    geolocationOptions

    @@ -2896,14 +2928,16 @@ If timeout parameter is not

    Example

    -
    // Options: watch for changes in position, and use the most
    -// accurate position acquisition method available.
    -//
    -var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true });
    +
    
    +    // Options: watch for changes in position, and use the most
    +    // accurate position acquisition method available.
    +    //
    +    var watchID = navigator.geolocation.watchPosition(onSuccess, onError, { enableHighAccuracy: true });
    +
    +    // ...later on...
     
    -// ...later on...
    +    navigator.geolocation.clearWatch(watchID);
     
    -navigator.geolocation.clearWatch(watchID);
     

    Position

    @@ -2974,6 +3008,420 @@ callback function when an error occurs w +

    Sample: Get the weather, find stores, and see photos of things nearby with Geolocation

    + +

    Use this plugin to help users find things near them such as Groupon deals, houses for sale, movies playing, sports and entertainment events and more.

    + +

    Here's a "cookbook" of ideas to get you started. In the snippets below, we'll show you some basic ways to add these features to your app.

    + + + +

    Get your geolocation coordinates

    +
    
    +function getWeatherLocation() {
    +
    +    navigator.geolocation.getCurrentPosition
    +    (onWeatherSuccess, onWeatherError, { enableHighAccuracy: true });
    +}
    +
    +
    +

    Get the weather forecast

    +
    
    +// Success callback for get geo coordinates
    +
    +var onWeatherSuccess = function (position) {
    +
    +    Latitude = position.coords.latitude;
    +    Longitude = position.coords.longitude;
    +
    +    getWeather(Latitude, Longitude);
    +}
    +
    +// Get weather by using coordinates
    +
    +function getWeather(latitude, longitude) {
    +
    +    // Get a free key at http://openweathermap.org/. Replace the "Your_Key_Here" string with that key.
    +    var OpenWeatherAppKey = "Your_Key_Here";
    +
    +    var queryString =
    +      'http://api.openweathermap.org/data/2.5/weather?lat='
    +      + latitude + '&lon=' + longitude + '&appid=' + OpenWeatherAppKey + '&units=imperial';
    +
    +    $.getJSON(queryString, function (results) {
    +
    +        if (results.weather.length) {
    +
    +            $.getJSON(queryString, function (results) {
    +
    +                if (results.weather.length) {
    +
    +                    $('#description').text(results.name);
    +                    $('#temp').text(results.main.temp);
    +                    $('#wind').text(results.wind.speed);
    +                    $('#humidity').text(results.main.humidity);
    +                    $('#visibility').text(results.weather[0].main);
    +
    +                    var sunriseDate = new Date(results.sys.sunrise);
    +                    $('#sunrise').text(sunriseDate.toLocaleTimeString());
    +
    +                    var sunsetDate = new Date(results.sys.sunrise);
    +                    $('#sunset').text(sunsetDate.toLocaleTimeString());
    +                }
    +
    +            });
    +        }
    +    }).fail(function () {
    +        console.log("error getting location");
    +    });
    +}
    +
    +// Error callback
    +
    +function onWeatherError(error) {
    +    console.log('code: ' + error.code + '\n' +
    +        'message: ' + error.message + '\n');
    +}
    +
    +
    +

    Receive updated weather forecasts as you drive around

    +
    
    +// Watch your changing position
    +
    +function watchWeatherPosition() {
    +
    +    return navigator.geolocation.watchPosition
    +    (onWeatherWatchSuccess, onWeatherError, { enableHighAccuracy: true });
    +}
    +
    +// Success callback for watching your changing position
    +
    +var onWeatherWatchSuccess = function (position) {
    +
    +    var updatedLatitude = position.coords.latitude;
    +    var updatedLongitude = position.coords.longitude;
    +
    +    if (updatedLatitude != Latitude && updatedLongitude != Longitude) {
    +
    +        Latitude = updatedLatitude;
    +        Longitude = updatedLongitude;
    +
    +        // Calls function we defined earlier.
    +        getWeather(updatedLatitude, updatedLongitude);
    +    }
    +}
    +
    +
    +

    See where you are on a map

    + +

    Both Bing and Google have map services. We'll use Google's. You'll need a key but it's free if you're just trying things out.

    + +

    Add a reference to the maps service.

    +
    
    + <script src="https://maps.googleapis.com/maps/api/js?key=Your_API_Key"></script>
    +
    +
    +

    Then, add code to use it.

    +
    
    +var Latitude = undefined;
    +var Longitude = undefined;
    +
    +// Get geo coordinates
    +
    +function getMapLocation() {
    +
    +    navigator.geolocation.getCurrentPosition
    +    (onMapSuccess, onMapError, { enableHighAccuracy: true });
    +}
    +
    +// Success callback for get geo coordinates
    +
    +var onMapSuccess = function (position) {
    +
    +    Latitude = position.coords.latitude;
    +    Longitude = position.coords.longitude;
    +
    +    getMap(Latitude, Longitude);
    +
    +}
    +
    +// Get map by using coordinates
    +
    +function getMap(latitude, longitude) {
    +
    +    var mapOptions = {
    +        center: new google.maps.LatLng(0, 0),
    +        zoom: 1,
    +        mapTypeId: google.maps.MapTypeId.ROADMAP
    +    };
    +
    +    map = new google.maps.Map
    +    (document.getElementById("map"), mapOptions);
    +
    +
    +    var latLong = new google.maps.LatLng(latitude, longitude);
    +
    +    var marker = new google.maps.Marker({
    +        position: latLong
    +    });
    +
    +    marker.setMap(map);
    +    map.setZoom(15);
    +    map.setCenter(marker.getPosition());
    +}
    +
    +// Success callback for watching your changing position
    +
    +var onMapWatchSuccess = function (position) {
    +
    +    var updatedLatitude = position.coords.latitude;
    +    var updatedLongitude = position.coords.longitude;
    +
    +    if (updatedLatitude != Latitude && updatedLongitude != Longitude) {
    +
    +        Latitude = updatedLatitude;
    +        Longitude = updatedLongitude;
    +
    +        getMap(updatedLatitude, updatedLongitude);
    +    }
    +}
    +
    +// Error callback
    +
    +function onMapError(error) {
    +    console.log('code: ' + error.code + '\n' +
    +        'message: ' + error.message + '\n');
    +}
    +
    +// Watch your changing position
    +
    +function watchMapPosition() {
    +
    +    return navigator.geolocation.watchPosition
    +    (onMapWatchSuccess, onMapError, { enableHighAccuracy: true });
    +}
    +
    +
    +

    Find stores near you

    + +

    You can use the same Google key for this.

    + +

    Add a reference to the places service.

    +
    
    +<script src=
    +"https://maps.googleapis.com/maps/api/js?key=Your_API_Key&libraries=places">
    +</script>
    +
    +
    +

    Then, add code to use it.

    +
    
    +var Map;
    +var Infowindow;
    +var Latitude = undefined;
    +var Longitude = undefined;
    +
    +// Get geo coordinates
    +
    +function getPlacesLocation() {
    +    navigator.geolocation.getCurrentPosition
    +    (onPlacesSuccess, onPlacesError, { enableHighAccuracy: true });
    +}
    +
    +// Success callback for get geo coordinates
    +
    +var onPlacesSuccess = function (position) {
    +
    +    Latitude = position.coords.latitude;
    +    Longitude = position.coords.longitude;
    +
    +    getPlaces(Latitude, Longitude);
    +
    +}
    +
    +// Get places by using coordinates
    +
    +function getPlaces(latitude, longitude) {
    +
    +    var latLong = new google.maps.LatLng(latitude, longitude);
    +
    +    var mapOptions = {
    +
    +        center: new google.maps.LatLng(latitude, longitude),
    +        zoom: 15,
    +        mapTypeId: google.maps.MapTypeId.ROADMAP
    +
    +    };
    +
    +    Map = new google.maps.Map(document.getElementById("places"), mapOptions);
    +
    +    Infowindow = new google.maps.InfoWindow();
    +
    +    var service = new google.maps.places.PlacesService(Map);
    +    service.nearbySearch({
    +
    +        location: latLong,
    +        radius: 500,
    +        type: ['store']
    +    }, foundStoresCallback);
    +
    +}
    +
    +// Success callback for watching your changing position
    +
    +var onPlacesWatchSuccess = function (position) {
    +
    +    var updatedLatitude = position.coords.latitude;
    +    var updatedLongitude = position.coords.longitude;
    +
    +    if (updatedLatitude != Latitude && updatedLongitude != Longitude) {
    +
    +        Latitude = updatedLatitude;
    +        Longitude = updatedLongitude;
    +
    +        getPlaces(updatedLatitude, updatedLongitude);
    +    }
    +}
    +
    +// Success callback for locating stores in the area
    +
    +function foundStoresCallback(results, status) {
    +
    +    if (status === google.maps.places.PlacesServiceStatus.OK) {
    +
    +        for (var i = 0; i < results.length; i++) {
    +
    +            createMarker(results[i]);
    +
    +        }
    +    }
    +}
    +
    +// Place a pin for each store on the map
    +
    +function createMarker(place) {
    +
    +    var placeLoc = place.geometry.location;
    +
    +    var marker = new google.maps.Marker({
    +        map: Map,
    +        position: place.geometry.location
    +    });
    +
    +    google.maps.event.addListener(marker, 'click', function () {
    +
    +        Infowindow.setContent(place.name);
    +        Infowindow.open(Map, this);
    +
    +    });
    +}
    +
    +// Error callback
    +
    +function onPlacesError(error) {
    +    console.log('code: ' + error.code + '\n' +
    +        'message: ' + error.message + '\n');
    +}
    +
    +// Watch your changing position
    +
    +function watchPlacesPosition() {
    +
    +    return navigator.geolocation.watchPosition
    +    (onPlacesWatchSuccess, onPlacesError, { enableHighAccuracy: true });
    +}
    +
    +
    +

    See pictures of things around you

    + +

    Digital photos can contain geo coordinates that identify where the picture was taken.

    + +

    Use Flickr API's to find pictures that folks have taken near you. Like Google services, you'll need a key, but it's free if you just want to try things out.

    +
    
    +var Latitude = undefined;
    +var Longitude = undefined;
    +
    +// Get geo coordinates
    +
    +function getPicturesLocation() {
    +
    +    navigator.geolocation.getCurrentPosition
    +    (onPicturesSuccess, onPicturesError, { enableHighAccuracy: true });
    +
    +}
    +
    +// Success callback for get geo coordinates
    +
    +var onPicturesSuccess = function (position) {
    +
    +    Latitude = position.coords.latitude;
    +    Longitude = position.coords.longitude;
    +
    +    getPictures(Latitude, Longitude);
    +}
    +
    +// Get pictures by using coordinates
    +
    +function getPictures(latitude, longitude) {
    +
    +    $('#pictures').empty();
    +
    +    var queryString =
    +    "https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=Your_API_Key&lat="
    +    + latitude + "&lon=" + longitude + "&format=json&jsoncallback=?";
    +
    +    $.getJSON(queryString, function (results) {
    +        $.each(results.photos.photo, function (index, item) {
    +
    +            var photoURL = "http://farm" + item.farm + ".static.flickr.com/" +
    +                item.server + "/" + item.id + "_" + item.secret + "_m.jpg";
    +
    +            $('#pictures').append($("<img />").attr("src", photoURL));
    +
    +           });
    +        }
    +    );
    +}
    +
    +// Success callback for watching your changing position
    +
    +var onPicturesWatchSuccess = function (position) {
    +
    +    var updatedLatitude = position.coords.latitude;
    +    var updatedLongitude = position.coords.longitude;
    +
    +    if (updatedLatitude != Latitude && updatedLongitude != Longitude) {
    +
    +        Latitude = updatedLatitude;
    +        Longitude = updatedLongitude;
    +
    +        getPictures(updatedLatitude, updatedLongitude);
    +    }
    +}
    +
    +// Error callback
    +
    +function onPicturesError(error) {
    +
    +    console.log('code: ' + error.code + '\n' +
    +        'message: ' + error.message + '\n');
    +}
    +
    +// Watch your changing position
    +
    +function watchPicturePosition() {
    +
    +    return navigator.geolocation.watchPosition
    +    (onPicturesWatchSuccess, onPicturesError, { enableHighAccuracy: true });
    +}
    +
    +
    Modified: cordova/site/public/docs/en/dev/reference/cordova-plugin-globalization/index.html URL: http://svn.apache.org/viewvc/cordova/site/public/docs/en/dev/reference/cordova-plugin-globalization/index.html?rev=1752402&r1=1752401&r2=1752402&view=diff ============================================================================== --- cordova/site/public/docs/en/dev/reference/cordova-plugin-globalization/index.html (original) +++ cordova/site/public/docs/en/dev/reference/cordova-plugin-globalization/index.html Wed Jul 13 11:51:10 2016 @@ -6,12 +6,12 @@ - + - cordova-plugin-globalization - Apache Cordova + Globalization - Apache Cordova @@ -732,7 +732,7 @@
  • - cordova-plugin-battery-status + Battery Status @@ -747,7 +747,7 @@
  • - cordova-plugin-camera + Camera @@ -762,7 +762,7 @@
  • - cordova-plugin-console + Console @@ -777,7 +777,7 @@
  • - cordova-plugin-contacts + Contacts @@ -792,7 +792,7 @@
  • - cordova-plugin-device + Device @@ -807,7 +807,7 @@
  • - cordova-plugin-device-motion + Device Motion @@ -822,7 +822,7 @@
  • - cordova-plugin-device-orientation + Device Orientation @@ -837,7 +837,7 @@
  • - cordova-plugin-dialogs + Dialogs @@ -852,7 +852,7 @@
  • - cordova-plugin-file + File @@ -867,7 +867,7 @@
  • - cordova-plugin-file-transfer + File Transfer @@ -882,7 +882,7 @@
  • - cordova-plugin-geolocation + Geolocation @@ -897,7 +897,7 @@
  • - cordova-plugin-globalization + Globalization @@ -914,7 +914,7 @@
  • - cordova-plugin-inappbrowser + Inappbrowser @@ -929,7 +929,7 @@
  • - cordova-plugin-media + Media @@ -944,7 +944,7 @@
  • - cordova-plugin-media-capture + Media Capture @@ -959,7 +959,7 @@
  • - cordova-plugin-network-information + Network Information @@ -974,7 +974,7 @@
  • - cordova-plugin-splashscreen + Splashscreen @@ -989,7 +989,7 @@
  • - cordova-plugin-vibration + Vibration @@ -1004,7 +1004,7 @@
  • - cordova-plugin-statusbar + Statusbar @@ -1019,7 +1019,7 @@
  • - cordova-plugin-whitelist + Whitelist @@ -1034,7 +1034,7 @@
  • - cordova-plugin-legacy-whitelist + Legacy Whitelist @@ -1388,7 +1388,7 @@
  • - cordova-plugin-battery-status + Battery Status
  • @@ -1397,7 +1397,7 @@
  • - cordova-plugin-camera + Camera
  • @@ -1406,7 +1406,7 @@
  • - cordova-plugin-console + Console
  • @@ -1415,7 +1415,7 @@
  • - cordova-plugin-contacts + Contacts
  • @@ -1424,7 +1424,7 @@
  • - cordova-plugin-device + Device
  • @@ -1433,7 +1433,7 @@
  • - cordova-plugin-device-motion + Device Motion
  • @@ -1442,7 +1442,7 @@
  • - cordova-plugin-device-orientation + Device Orientation
  • @@ -1451,7 +1451,7 @@
  • - cordova-plugin-dialogs + Dialogs
  • @@ -1460,7 +1460,7 @@
  • - cordova-plugin-file + File
  • @@ -1469,7 +1469,7 @@
  • - cordova-plugin-file-transfer + File Transfer
  • @@ -1478,7 +1478,7 @@
  • - cordova-plugin-geolocation + Geolocation
  • @@ -1487,7 +1487,7 @@
  • - cordova-plugin-globalization + Globalization
  • @@ -1496,7 +1496,7 @@
  • - cordova-plugin-inappbrowser + Inappbrowser
  • @@ -1505,7 +1505,7 @@
  • - cordova-plugin-media + Media
  • @@ -1514,7 +1514,7 @@
  • - cordova-plugin-media-capture + Media Capture
  • @@ -1523,7 +1523,7 @@
  • - cordova-plugin-network-information + Network Information
  • @@ -1532,7 +1532,7 @@
  • - cordova-plugin-splashscreen + Splashscreen
  • @@ -1541,7 +1541,7 @@
  • - cordova-plugin-vibration + Vibration
  • @@ -1550,7 +1550,7 @@
  • - cordova-plugin-statusbar + Statusbar
  • @@ -1559,7 +1559,7 @@
  • - cordova-plugin-whitelist + Whitelist
  • @@ -1568,7 +1568,7 @@
  • - cordova-plugin-legacy-whitelist + Legacy Whitelist
  • @@ -2688,7 +2688,25 @@ # under the License. --> -

    Build Status

    + + + + + + + + + + + + + + + + + + +
    AndroidiOSWindows 8.1 StoreWindows 8.1 PhoneWindows 10 StoreTravis CI
    Build StatusBuild StatusBuild StatusBuild StatusBuild StatusBuild Status

    cordova-plugin-globalization

    --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org