christocracy / cordova-plugin-background-geolocation

Sophisticated, battery-conscious, cross-platform background-geolocation with motion-detection
http://transistorsoft.github.io/cordova-background-geolocation
492 stars 743 forks source link

HTTP failure: undefined undefined #243

Closed popcorn245 closed 8 years ago

popcorn245 commented 8 years ago

I have been banging me head against the wall with this plugin. It seems intermittent at best. Some time it will log the location without issues, but then I stop it and try to start it again and it won't log locations.

I finally found out how to see if the plugin is even hitting my http endpoint and I get HTTP failure: undefined undefined when running the code below. When it works it's awesome, please help me clear this up...

                  this.bgGeo.onHttp(function(response) {
                        var status = response.status;
                        var responseText = response.responseText;
                        console.log('HTTP success', status, responseText);
                    }, function(response) {
                        var status = response.status;
                        var responseText = response.responseText;
                        console.log('HTTP failure: ', status, responseText);
                    }); 
christocracy commented 8 years ago

You'll have to tell me which platform you're dealing with, iOS or Android.

popcorn245 commented 8 years ago

Android

christocracy commented 8 years ago

Observing onHttp is not how you go about debugging. For Android you monitor adb logcat.

$ adb logcat -s TSLocationManager

Show me some logs.

popcorn245 commented 8 years ago

Okay I can see I am getting a 500 error. Is there a way I can get more info on the error?

I/TSLocationManager(21607): - Pending sync requests: 0
I/TSLocationManager(21607): - onPause
I/TSLocationManager(21607): - Activity received: still, confidence: 100
I/TSLocationManager(21607): - schedulePostLocations (pending-requests: 0)
I/TSLocationManager(21607):   Locked 19 records
I/TSLocationManager(21607): - createBatchRequest
I/TSLocationManager(21607):
I/TSLocationManager(21607): ***
I/TSLocationManager(21607): * HTTP ERROR: 500
I/TSLocationManager(21607): * com.android.volley.ServerError
I/TSLocationManager(21607): * <!DOCTYPE html>
I/TSLocationManager(21607): <html>
I/TSLocationManager(21607):     <head>
I/TSLocationManager(21607):         <meta charset="UTF-8" />
I/TSLocationManager(21607):         <meta name="robots" content="noindex,nofollow" />
I/TSLocationManager(21607):         <style>
I/TSLocationManager(21607):             /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
I/TSLocationManager(21607):             html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;bo
I/TSLocationManager(21607): ***
D/TSLocationManager(21607): - Unlock uuid: c7b3947d-1b90-44c7-8683-a99519be2afb
D/TSLocationManager(21607): - Unlock uuid: c0722b68-c11c-4d25-92a9-3daeab24a6f8
D/TSLocationManager(21607): - Unlock uuid: bca9beb7-672a-43e6-a895-fcf1e0029aba
D/TSLocationManager(21607): - Unlock uuid: 57ae2d7d-29df-4496-aa43-e2ff10241c4d
D/TSLocationManager(21607): - Unlock uuid: 733d6173-b9fd-45a9-9309-d8e793519984
D/TSLocationManager(21607): - Unlock uuid: e6af0be5-a6b2-4daf-bd4b-74569e797624
D/TSLocationManager(21607): - Unlock uuid: 2339f7d3-ebf3-44cd-8979-bbeaa40b8d73
D/TSLocationManager(21607): - Unlock uuid: fc15c5f3-1e8b-4103-a134-aee2a8abffc7
D/TSLocationManager(21607): - Unlock uuid: 5c58505f-74bd-45b6-9bb0-828dbbd1cbb4
D/TSLocationManager(21607): - Unlock uuid: e81855c2-72b2-4c4d-b90a-56dc2c2891f7
D/TSLocationManager(21607): - Unlock uuid: e34a3bea-e5e4-4ade-82b8-931aedbf39b5
D/TSLocationManager(21607): - Unlock uuid: ad265c84-e6de-459c-aba0-53d1e8d63547
D/TSLocationManager(21607): - Unlock uuid: fdddaa88-dc95-4f36-98aa-c31fd2a9d6bd
D/TSLocationManager(21607): - Unlock uuid: e5065cc3-e484-4a0f-8398-70e888c2eea8
D/TSLocationManager(21607): - Unlock uuid: 4b1750e1-34ce-472b-a753-28e0ada00d32
D/TSLocationManager(21607): - Unlock uuid: 63bf5897-375a-48c7-8826-e75814e59ca8
D/TSLocationManager(21607): - Unlock uuid: 051508a8-2112-4a18-a4e3-4f60f02a96b3
D/TSLocationManager(21607): - Unlock uuid: a45d5b87-a34c-483d-9365-b6362f7db54f
D/TSLocationManager(21607): - Unlock uuid: e6c110e9-156b-4534-9593-b0bb419f0645
I/TSLocationManager(21607): - Pending sync requests: 0
christocracy commented 8 years ago

Asking my plugin why your server is returning 500 is not how you solve your problem. Go look at your server logs.

popcorn245 commented 8 years ago

lol fair enough...