transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

http is not fired by this plugin #698

Closed aaronharper123 closed 5 years ago

aaronharper123 commented 5 years ago

I want to track user by this plugin but plugin does not fire http url with location template... all things are work fine except url.

I want to post JSON object like: { "LocationData": { "Lat": "23.00002", "Long": "72.145452", "Date": "Sat Jun 09 2018 12:31:41 GMT+0530 (IST)", "BatteryPerc": 44, "UserId": 4, } }

My code is below for above json object, url: 'http://property.zoomi.in:86/api/User/IOS_UserTracking', httpRootProperty: 'LocationData', locationTemplate: '{"Lat":<%= latitude %>,"Long":<%= longitude %>, "Date":"<%= timestamp %>", "BatteryPerc":<%= battery.level %>}', extras: { "UserId": 4 }

But problem is that , url not fired .. plugin is call onHttpFailure method and its console is:

screen shot 2018-06-09 at 6 11 01 pm

Your Environment

` this.bgGeo.ready({ // Geolocation config desiredAccuracy: 0, distanceFilter: 0, stationaryRadius: 0, // Activity Recognition config stopTimeout: 5, // Application config debug: true, // <-- Debug sounds & notifications. reset: true, logLevel: this.bgGeo.LOG_LEVEL_VERBOSE, stopOnTerminate: false, startOnBoot: true, method: "POST", autoSync: true, maxDaysToPersist: 3, url: 'http://property.zoomi.in:86/api/User/IOS_UserTracking', httpRootProperty: 'LocationData', locationTemplate: '{"Lat":<%= latitude %>,"Long":<%= longitude %>, "Date":"<%= timestamp %>", "BatteryPerc":<%= battery.level %>}', extras: { "UserId": 4 }

}, function(state) { // This callback is executed when the plugin is ready to use. console.log("BackgroundGeolocation ready: ", state); this.bgGeo.start(); }); `

Expected Behavior

Actual Behavior

Steps to Reproduce

1. 2. 3. 4.

Context

Debug logs

please see snap of await bg.getState();

screen shot 2018-06-09 at 6 05 49 pm

screen shot 2018-06-09 at 6 06 14 pm

Please see my logs of await bg.getLog()

`"2018-06-07 23:12:39.287 ℹ️-[TSConfig persist]

2018-06-07 23:12:39.295 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 0

2018-06-07 23:12:39.298 πŸ”΅-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 0

2018-06-07 23:12:39.303 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 0

2018-06-07 23:12:39.305 πŸ”΅-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 0

2018-06-07 23:12:39.306 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 0

2018-06-07 23:12:41.073 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 4

2018-06-07 23:12:41.077 πŸ”΅-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 4

2018-06-07 23:12:41.095 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 4

2018-06-07 23:12:41.101 πŸ”΅-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 4

2018-06-07 23:12:41.103 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 4

2018-06-07 23:13:04.220 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager start] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.220 ℹ️-[TSLocationManager doStart:] trackingMode: 1

2018-06-07 23:13:04.220 ℹ️-[TSConfig persist]

2018-06-07 23:13:04.223 🎾-[TSGeofenceManager start]

2018-06-07 23:13:04.224 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 1 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.226 πŸ”΅-[TSLocationManager setPace:] 0

2018-06-07 23:13:04.235 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

2018-06-07 23:13:04.267 ℹ️+[LocationAuthorization run:] status: 4

2018-06-07 23:13:04.267 ℹ️-[TSConfig persist]

2018-06-07 23:13:04.276 🎾-[TSLocationManager startMonitoringBackgroundFetch] BackgroundFetch: ON

2018-06-07 23:13:04.297 πŸ“<+37.72785494,-122.44414735> +/- 5.00m (speed 32.98 mps / course 46.76) @ 6/7/18, 11:12:56 PM India Standard Time

2018-06-07 23:13:04.297 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 7.6s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.297 ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

2018-06-07 23:13:04.716 πŸ“<+37.73218822,-122.43102732> +/- 5.00m (speed 32.58 mps / course 86.13) @ 6/7/18, 11:13:04 PM India Standard Time

2018-06-07 23:13:04.716 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 0.0s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.716 βœ…-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+37.73218822,-122.43102732> +/- 5.00m (speed 32.58 mps / course 86.13) @ 6/7/18, 11:13:04 PM India Standard Time

2018-06-07 23:13:04.716 πŸ”΅-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 50

2018-06-07 23:13:04.723 πŸ”΄-[TSLocationManager stopUpdatingLocation]

2018-06-07 23:13:04.728 πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0

2018-06-07 23:13:04.728 🎾-[TSLocationManager startMonitoringSignificantLocationChanges]

2018-06-07 23:13:04.732 βœ…-[TSLocationManager persistLocation:]_block_invoke INSERT: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:04.733 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService flush:error:] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.743 βœ…-[BackgroundTaskManager createBackgroundTask] 3

2018-06-07 23:13:04.747 βœ…-[TSHttpService schedulePost:] LOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:04.856 ⚠️-[TSHttpService doPost:] HTTP ERROR: 404


2018-06-07 23:13:04.861 βœ…-[TSHttpService post:error:] UNLOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:04.861 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 0 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:04.861 βœ…-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 3 OF ( 3 )

2018-06-07 23:13:08.532 πŸ”΅-[TSLocationManager onSuspend:] enabled? 1)

2018-06-07 23:13:08.555 ℹ️-[TSDBLogger db_save] Log committed

2018-06-07 23:13:10.336 πŸ”΅-[BackgroundTaskManager locationManager:didChangeAuthorizationStatus:] 3

2018-06-07 23:13:10.336 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 3

2018-06-07 23:13:10.375 πŸ”΅-[TSLocationManager locationManager:didChangeAuthorizationStatus:] status 3

2018-06-07 23:13:10.388 πŸ”΅-[TSLocationManager setPace:] 0

2018-06-07 23:13:10.394 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

2018-06-07 23:13:10.421 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

2018-06-07 23:13:10.424 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 3

2018-06-07 23:13:10.428 πŸ”΅-[LocationManager locationManager:didChangeAuthorizationStatus:] 3

2018-06-07 23:13:10.434 πŸ“<+37.73218822,-122.43102732> +/- 5.00m (speed 32.58 mps / course 86.13) @ 6/7/18, 11:13:04 PM India Standard Time

2018-06-07 23:13:10.435 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 5.7s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:10.435 ℹ️-[TSLocationManager locationManager:didUpdateLocations:] Received stale motionchange location. Retrying...

2018-06-07 23:13:10.449 ℹ️+[LocationAuthorization run:] status: 3

2018-06-07 23:13:10.449 ℹ️-[TSConfig persist]

2018-06-07 23:13:10.455 ℹ️+[LocationAuthorization run:] status: 3

2018-06-07 23:13:10.456 πŸ“<+37.73212414,-122.42955135> +/- 5.00m (speed 33.39 mps / course 99.14) @ 6/7/18, 11:13:10 PM India Standard Time

2018-06-07 23:13:10.456 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 0 | df: -1.0m | age: 0.1s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:10.456 βœ…-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+37.73212414,-122.42955135> +/- 5.00m (speed 33.39 mps / course 99.14) @ 6/7/18, 11:13:10 PM India Standard Time

2018-06-07 23:13:10.457 ℹ️-[TSConfig persist]

2018-06-07 23:13:10.459 πŸ”΅-[TSConfig incrementOdometer:] 130.3

2018-06-07 23:13:10.459 πŸ”΅-[TSLocationManager startMonitoringStationaryRegion:radius:] Radius: 50

2018-06-07 23:13:10.468 πŸ”΄-[TSLocationManager stopUpdatingLocation]

2018-06-07 23:13:10.477 πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0

2018-06-07 23:13:10.480 βœ…-[TSLocationManager persistLocation:]_block_invoke INSERT: 69834F2F-169B-4D5A-8A03-5301DE5908F0

2018-06-07 23:13:10.482 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService flush:error:] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:10.482 βœ…-[BackgroundTaskManager createBackgroundTask] 9

2018-06-07 23:13:10.485 βœ…-[TSHttpService schedulePost:] LOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:10.569 ⚠️-[TSHttpService doPost:] HTTP ERROR: 404


2018-06-07 23:13:10.572 βœ…-[TSHttpService post:error:] UNLOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:10.572 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 0 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:10.573 βœ…-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 9 OF ( 9 )

2018-06-07 23:13:14.098 πŸ”΅-[TSLocationManager onResume:] enabled? 1

2018-06-07 23:13:14.100 ℹ️-[LocationDAO purge:] 3

2018-06-07 23:13:14.101 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService flush:error:] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:14.101 βœ…-[BackgroundTaskManager createBackgroundTask] 10

2018-06-07 23:13:14.105 βœ…-[TSHttpService schedulePost:] LOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:14.106 ℹ️-[TSDBLogger db_save] Log committed

2018-06-07 23:13:14.165 ⚠️-[TSHttpService doPost:] HTTP ERROR: 404


2018-06-07 23:13:14.168 βœ…-[TSHttpService post:error:] UNLOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:14.169 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 0 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:14.169 βœ…-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 10 OF ( 10 )

2018-06-07 23:13:15.726 πŸ”΅-[TSLocationManager locationManager:didExitRegion:] Exit stationary region

2018-06-07 23:13:15.726 πŸ”΅-[TSLocationManager setPace:] 1

2018-06-07 23:13:15.726 ℹ️-[TSConfig persist]

2018-06-07 23:13:15.729 🎾-[SOMotionDetector startShakeDetection:] sample-rate: 0.2 | M7 DISABLED

2018-06-07 23:13:15.737 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

2018-06-07 23:13:15.786 ℹ️+[LocationAuthorization run:] status: 3

2018-06-07 23:13:15.787 πŸ“<+37.73162273,-122.42693637> +/- 5.00m (speed 33.78 mps / course 104.06) @ 6/7/18, 11:13:15 PM India Standard Time

2018-06-07 23:13:15.788 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: -1.0m | age: 0.1s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:15.788 βœ…-[TSLocationManager locationManager:didUpdateLocations:] Acquired motionchange position: <+37.73162273,-122.42693637> +/- 5.00m (speed 33.78 mps / course 104.06) @ 6/7/18, 11:13:15 PM India Standard Time

2018-06-07 23:13:15.800 🎾-[TSLocationManager startUpdatingLocation] Location-services: ON

2018-06-07 23:13:15.808 πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0

2018-06-07 23:13:15.810 ℹ️-[TSConfig persist]

2018-06-07 23:13:15.814 πŸ”΅-[TSConfig incrementOdometer:] 367.4

2018-06-07 23:13:15.816 βœ…-[TSLocationManager persistLocation:]_block_invoke INSERT: 82401987-EB3F-411A-9029-5C6FDC013BD2

2018-06-07 23:13:15.820 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService flush:error:] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:15.821 βœ…-[BackgroundTaskManager createBackgroundTask] 11

2018-06-07 23:13:15.823 βœ…-[TSHttpService schedulePost:] LOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:15.862 ℹ️+[LocationAuthorization run:] status: 3

2018-06-07 23:13:15.887 ⚠️-[TSHttpService doPost:] HTTP ERROR: 404


2018-06-07 23:13:15.890 βœ…-[TSHttpService post:error:] UNLOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:15.891 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 0 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:15.891 βœ…-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 11 OF ( 11 )

2018-06-07 23:13:40.726 πŸ“<+37.73188454,-122.41767864> +/- 5.00m (speed 32.94 mps / course 91.05) @ 6/7/18, 11:13:40 PM India Standard Time

2018-06-07 23:13:40.726 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 800.0m | age: 0.0s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:40.727 πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0

2018-06-07 23:13:40.727 ℹ️-[TSConfig persist]

2018-06-07 23:13:40.729 πŸ”΅-[TSConfig incrementOdometer:] 1184.0

2018-06-07 23:13:40.732 βœ…-[TSLocationManager persistLocation:]_block_invoke INSERT: 28569C8E-4007-499A-BC08-8063EF820453

2018-06-07 23:13:40.734 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService flush:error:] β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:40.734 βœ…-[BackgroundTaskManager createBackgroundTask] 12

2018-06-07 23:13:40.737 βœ…-[TSHttpService schedulePost:] LOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:40.798 ⚠️-[TSHttpService doPost:] HTTP ERROR: 404


2018-06-07 23:13:40.801 βœ…-[TSHttpService post:error:] UNLOCKED: 43E6A71C-6B70-4D04-B78C-E019710B94B6

2018-06-07 23:13:40.801 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSHttpService finish:error:] Success: 0 β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:13:40.801 βœ…-[BackgroundTaskManager stopBackgroundTask:]_block_invoke 12 OF ( 12 )

2018-06-07 23:14:06.724 πŸ“<+37.73452375,-122.40920939> +/- 5.00m (speed 27.89 mps / course 56.60) @ 6/7/18, 11:14:06 PM India Standard Time

2018-06-07 23:14:06.724 ╔═══════════════════════════════════════════════════════════ β•‘ -[TSLocationManager locationManager:didUpdateLocations:] Enabled: 1 | isMoving: 1 | df: 800.0m | age: 0.0s β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•

2018-06-07 23:14:06.724 πŸ”΅-[TSLocationManager locationManager:didUpdateLocations:] Updated distanceFilter, new: 700.000000, old: 800.000000

2018-06-07 23:14:06.728 πŸ”΅-[TSLocationManager calculateMedianLocationAccuracy:] Median location accuracy: 5.0

2018-06-07 23:14:06.729 ℹ️-[TSConfig persist]

2018-06-07 23:14:06.731 πŸ”΅-[TSConfig incrementOdometer:] 1986.0

2018-06-07 23:14:06.734 βœ…-[TSLocationManager persistLocation:]_block_invoke INSERT: C9CF8666-7A58-4AF1-8A0A-1448531288B8

2018-06-07 23:14:06.736 `

then etc......................

aaronharper123 commented 5 years ago

And web service is already made as i want Post JSON object

christocracy commented 5 years ago

The locationTemplate is not used for the location provided to the β€œlocation” event. It is only used for the data rendered to to http request.

Also, after changing locationTemplate, make sure all existing locations in plugin database are destroyed. From JavaScript console, execute bg.destroyLocations()

aaronharper123 commented 5 years ago

screen shot 2018-06-09 at 6 34 34 pm

aaronharper123 commented 5 years ago

and for post json object, i asked you yesterday and you told me do like:

{ "LocationData": { "Lat": "23.00002", "Long": "72.145452", "Date": "Sat Jun 09 2018 12:31:41 GMT+0530 (IST)", "BatteryPerc": 44, "UserId": 4, } }

My code is below for above json object, url: 'http://property.zoomi.in:86/api/User/IOS_UserTracking', httpRootProperty: 'LocationData', locationTemplate: '{"Lat":<%= latitude %>,"Long":<%= longitude %>, "Date":"<%= timestamp %>", "BatteryPerc":<%= battery.level %>}', extras: { "UserId": 4 }

aaronharper123 commented 5 years ago

i referred https://github.com/transistorsoft/cordova-background-geolocation-lt/tree/master/docs#config-string-locationtemplate-undefined . for my json object

christocracy commented 5 years ago

Are you not observing the provided data at your server logs?

aaronharper123 commented 5 years ago

no

aaronharper123 commented 5 years ago

i also add header like headers: { // <-- Optional HTTP headers "Content-Type": "application/json" }

but get same error

christocracy commented 5 years ago

The plugin automatically adds the header "Content-Type": "application/json" }

Log the incoming JSON at your server and observe your server logs.

aaronharper123 commented 5 years ago

let me implement the logs on server and then i will check

aaronharper123 commented 5 years ago

Please check my log:

screen shot 2018-06-11 at 2 53 09 pm

aaronharper123 commented 5 years ago

And I also check this web service in postman , and it works fine in postman.

screen shot 2018-06-11 at 2 57 07 pm

christocracy commented 5 years ago

There’s no possible way the plugin sends null data. You’re doing something wrong.

Remove the locationTemplate (and destroyLocations). Observe logs.

aaronharper123 commented 5 years ago

i get same LocationData: null. Please check my server log.

6/11/2018 4:42:40 PM - IOS_UserTracking

Request Parameter

{ "obj": { "LocationData": null } }

i remove locationTemplate but get same problem.. i referred https://github.com/transistorsoft/cordova-background-geolocation-lt/tree/master/docs#config-string-locationtemplate-undefined . for my json object

and if am i doing wrong then please tell me.

christocracy commented 5 years ago

Yes, you’re absolutely doing something wrong on the server. I’m not sure you have a clue what you’re doing.

You need to log the **raw JSON text from the HTTP request. Log the entire HTTP request.

aaronharper123 commented 5 years ago

Hello christocracy, i logged raw json text, please see my logs below,


6/11/2018 6:55:22 PM ----- Request Parameter

Method: POST, RequestUri: 'http://property.zoomi.in:86/api/User/IOS_UserTracking', Version: 1.1, Content: System.Web.Http.WebHost.HttpControllerHandler+LazyStreamContent, Headers: { Connection: keep-alive Accept: / Accept-Encoding: gzip Accept-Encoding: deflate Accept-Language: en-us Host: property.zoomi.in:86 User-Agent: Galio/1.0.0 User-Agent: CFNetwork/808.3 User-Agent: Darwin/16.3.0 Content-Length: 131 Content-Type: application/json } [ { "LocationData": null } ]

6/11/2018 6:55:22 PM ----- Request Parameter

Method: POST, RequestUri: 'http://property.zoomi.in:86/api/User/IOS_UserTracking', Version: 1.1, Content: System.Web.Http.WebHost.HttpControllerHandler+LazyStreamContent, Headers: { Connection: keep-alive Accept: / Accept-Encoding: gzip Accept-Encoding: deflate Accept-Language: en-us Host: property.zoomi.in:86 User-Agent: Galio/1.0.0 User-Agent: CFNetwork/808.3 User-Agent: Darwin/16.3.0 Content-Length: 131 Content-Type: application/json } [ { "LocationData": null } ]

aaronharper123 commented 5 years ago

i request two web service and i get above logs at server..

aaronharper123 commented 5 years ago

Hello sir, please update me

christocracy commented 5 years ago

Content-Length: 131

Clearly there's 131 characters in the HTTP request.

The following is only 25 characters.

}[{"LocationData": null}]

There data is there.

aaronharper123 commented 5 years ago

I cant understand what are you trying to say, please explain in detail

aaronharper123 commented 5 years ago

i chacked again my js code but i did same as in link which are you provide. please solve my question

aaronharper123 commented 5 years ago

i checked web service , but this is ok and web service is worked fine when we call by angular http request but plugin occured error, if am i doing wrong in js code then please check and suggest me any correction

aaronharper123 commented 5 years ago

hello I am not getting any response of my question yet

aaronharper123 commented 5 years ago

Hello @christocracy I am getting something interesting, when I am tested app in the simulator then the plugin is fired URL successfully, but when I am tested app in real device then plugin does not fire the URL successfully, and it gives 500 error:

why ?

christocracy commented 5 years ago

Because the plugin stores the rendered JSON of a location in its database at the time the location was recorded.

The plugin will keep attempting to post these queued records over and over (oldest first) until your server returns 200.

When the plugin receives an error, it immediately gives up on posting more.

destroyLocations

aaronharper123 commented 5 years ago

ok but I cant understand why the plugin is not fire error when I am testing app in the simulator. The plugin is fire error when I am testing app in the real device.

christocracy commented 5 years ago

Because the one on device had queued locations from previous attempts at modifying the locationTemplate and you didn’t clear those from the queue with #destroyLocations.

aaronharper123 commented 5 years ago

one another question, my battery is 100% charged but i get battery.level is 1 Why ?

christocracy commented 5 years ago

because: 1 = 100% 0 = empty 0.5 = 50%

aaronharper123 commented 5 years ago

destroyLocations

It is still not working yet, now what am I doing? Why are you closed this issue before my issue is solved

aaronharper123 commented 5 years ago

1 = 100% 0 = empty 0.5 = 50%

then what is the meaning of - 1? because i am now also getting -1

christocracy commented 5 years ago

-1 = unknown (eg: simulator, which doesn't have a battery)

aaronharper123 commented 5 years ago

destroyLocations

i am get success only one time after that all url are fired as a fail(500 error) bu this the plugin. please give me proper solution

christocracy commented 5 years ago

It's closed because your issues are between you and your server. The plugin's HTTP service is 100% reliable and doesn't change behaviour on simulator vs device.

aaronharper123 commented 5 years ago

-1 = unknown (eg: simulator, which doesn't have a battery)

but i am getting -1 also in real device which have around 97% battery

aaronharper123 commented 5 years ago

It's closed because your issues are between you and your server. The plugin's HTTP service is 100% reliable and doesn't change behaviour on simulator vs device.

If my server has the problem then simulator should not also fire as a successful, Why the plugin is fired fail the url only in real device ?

aaronharper123 commented 5 years ago

please reopen the issue and I am requesting to solve my issue

aaronharper123 commented 5 years ago

I told you again, if i am doing something wrong in js code then suggest me

aaronharper123 commented 5 years ago

-1 = unknown (eg: simulator, which doesn't have a battery)

please see snap, i am testing app in real device and i get -1 in battery.level and also see my error 500

screen shot 2018-06-13 at 7 15 18 pm

aaronharper123 commented 5 years ago

hello sir, please give response

aaronharper123 commented 5 years ago

Hello @christocracy Please understand this scenario, If a problem is in the server then URL should not fire in a simulator. But the Plugin is firing the URL in a simulator. So the problem is not on the server side.

aaronharper123 commented 5 years ago

And if you want to see code of a web service then i can