{"action":"created","issue":{"url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/195","labels_url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/195/labels{/name}","comments_url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/195/comments","events_url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/195/events","html_url":"https://github.com/christocracy/cordova-plugin-background-geolocation/issues/195","id":88471288,"number":195,"title":"background location not sending data to my server","user":{"login":"cissemy","id":87177,"avatar_url":"https://avatars.githubusercontent.com/u/87177?v=3","gravatar_id":"","url":"https://api.github.com/users/cissemy","html_url":"https://github.com/cissemy","followers_url":"https://api.github.com/users/cissemy/followers","following_url":"https://api.github.com/users/cissemy/following{/other_user}","gists_url":"https://api.github.com/users/cissemy/gists{/gist_id}","starred_url":"https://api.github.com/users/cissemy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cissemy/subscriptions","organizations_url":"https://api.github.com/users/cissemy/orgs","repos_url":"https://api.github.com/users/cissemy/repos","events_url":"https://api.github.com/users/cissemy/events{/privacy}","received_events_url":"https://api.github.com/users/cissemy/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-06-15T16:11:24Z","updated_at":"2015-06-30T00:13:00Z","closed_at":null,"body":"For some reason my app is not sending back to the server my location.\r\nI am using :\r\n\r\n```\r\nvar courier = '0992';\r\nvar bgGeo;\r\nfunction onDeviceReady() {\r\n   if (window.plugins.backgroundGeoLocation) {\r\n        configureBackgroundGeoLocation();\r\n    }\r\n}\r\nconfigureBackgroundGeoLocation=function () {\r\n    // Your app must execute AT LEAST ONE call for the current position via standard Cordova geolocation,\r\n    //  in order to prompt the user for Location permission.\r\n    window.navigator.geolocation.getCurrentPosition(function (position) {\r\n        console.log('Location from Phonegap');\r\n    });\r\n\r\n     bgGeo = window.plugins.backgroundGeoLocation;\r\n\r\n    /**\r\n    * This would be your own callback for Ajax-requests after POSTing background geolocation to your server.\r\n    */\r\n    var yourAjaxCallback = function (response) {\r\n      \r\n        bgGeo.finish();\r\n    };\r\n\r\n    /**\r\n    * This callback will be executed every time a geolocation is recorded in the background.\r\n    */\r\n    var callbackFn = function (position) {\r\n        console.log('[js] BackgroundGeoLocation callback:  ' + position.latitudue + ',' + position.longitude);\r\n        // Do your HTTP request here to POST location to your server.\r\n        // this part is not working\r\n         var url = \"http://myserver/service1.asmx/Courier_GPS?CourierID=\" + courier + \"&Latitude=\" + position.coords.latitude + \"&Longitude=\" + position.coords.longitude;\r\n        $.ajax({\r\n            type: \"GET\",\r\n            url: url,\r\n            dataType: \"json\",\r\n            success: function (xml) {\r\n                var p = JSON.stringify(xml.GPS);\r\n                var v = JSON.parse(p);\r\n                if (v[0].Warning === \"\") {\r\n                    console.log('backgrd Gps successfuly'); // showToast('toast', 'backgrd Gps successfuly!', 'success');\r\n                }\r\n                else {\r\n                    console.log('backgrd Gps error'); // showToast('toast', v[0].Warning, 'error');\r\n                }\r\n            },\r\n            error: function (xml) {\r\n                console.log('backgrd Gps error')//showToast('toast', 'Gps Error!', 'error');\r\n            }\r\n        });   \r\n        yourAjaxCallback.call(this);\r\n    };\r\n\r\n    var failureFn = function (error) {\r\n        console.log('BackgroundGeoLocation error');\r\n    }\r\n\r\n    // BackgroundGeoLocation is highly configurable.\r\n    bgGeo.configure(callbackFn, failureFn, {\r\n       \r\n        desiredAccuracy: 10,\r\n        stationaryRadius: 20,\r\n        distanceFilter: 30,\r\n       // notificationTitle: 'Background tracking',   // <-- android only, customize the title of the notification\r\n        //notificationText: 'ENABLED',                // <-- android only, customize the text of the notification\r\n        activityType: \"AutomotiveNavigation\",       // <-- iOS-only\r\n        debug: true     // <-- enable this hear sounds for background-geolocation life-cycle.\r\n    });\r\n\r\n    // Turn ON the background-geolocation system.  The user will be tracked whenever they suspend the app.\r\n    bgGeo.start();\r\n\r\n    // If you wish to turn OFF background-tracking, call the #stop method.\r\n    // bgGeo.stop()\r\n}\r\n```\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/comments/116884749","html_url":"https://github.com/christocracy/cordova-plugin-background-geolocation/issues/195#issuecomment-116884749","issue_url":"https://api.github.com/repos/christocracy/cordova-plugin-background-geolocation/issues/195","id":116884749,"user":{"login":"cissemy","id":87177,"avatar_url":"https://avatars.githubusercontent.com/u/87177?v=3","gravatar_id":"","url":"https://api.github.com/users/cissemy","html_url":"https://github.com/cissemy","followers_url":"https://api.github.com/users/cissemy/followers","following_url":"https://api.github.com/users/cissemy/following{/other_user}","gists_url":"https://api.github.com/users/cissemy/gists{/gist_id}","starred_url":"https://api.github.com/users/cissemy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cissemy/subscriptions","organizations_url":"https://api.github.com/users/cissemy/orgs","repos_url":"https://api.github.com/users/cissemy/repos","events_url":"https://api.github.com/users/cissemy/events{/privacy}","received_events_url":"https://api.github.com/users/cissemy/received_events","type":"User","site_admin":false},"created_at":"2015-06-30T00:13:00Z","updated_at":"2015-06-30T00:13:00Z","body":"Yes. I did it.\r\nMy code is based on sampleApp.\r\nThanks"}}