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
656 stars 277 forks source link

Not sending data along with the URL #1423

Closed MazahirA closed 7 months ago

MazahirA commented 7 months ago

App is hitting the server, but attaching no data with it. My Environment

Expected Behavior:

The plugin should send/attach data along with the URL.

Actual Behavior

The plugin is hitting the server with no data attached with the URL.

Steps to Reproduce

  1. Create a Cordova project.
  2. Install the Plugin.
  3. Configure it and define the desired URL.
  4. Build the app and test in debug mode.

Context

I was trying to track the current location of a test user and send the locations to the server.

Debug logs

<summary>In the logs, the URL shows no data attached with it.</summary>
199.188.1.199 POST /abc.com/Controller/Test - 80 - 195.143.5.22 okhttp/3.12.13 - 200 0 11 12321
199.188.1.199 POST /abc.com/Controller/Test  - 80 - 195.143.5.22 okhttp/3.12.13 - 200 0 11 12321
199.188.1.199 POST /abc.com/Controller/Test  - 80 - 195.143.5.22 okhttp/3.12.13 - 200 0 11 12321

christocracy commented 7 months ago

Your server seemed happy enough to return 200.

Where are you expecting the data in the HTTP request?

MazahirA commented 7 months ago

Like this, when I tried it with Postman: The ''params: { "latitudee": 12.3 }'' or location is missing.

199.188.1.199 POST /abc.com/Controller/Test params: { "latitudee": 12.3 } 80 - 192.168.5.171 PostmanRuntime/7.33.0 - 200 0 0 1530

christocracy commented 7 months ago

Where are you expecting the data in the HTTP request?

MazahirA commented 7 months ago

I'm expecting the plugin to attach the data after the ~/Test, just like it does when I test it with Postman.

199.188.1.199 POST /abc.com/Controller/Test "Here" - 80 - 195.143.5.22 okhttp/3.12.13 - 200 0 11 12321

christocracy commented 7 months ago

You're likely not looking in the right place for the data. You'll find the data in the "request body". The entire request body is JSON data.

MazahirA commented 7 months ago

How do we get that data on server side? I mean how can we catch that data to insert in the DB? I'm using .NET on server side.

christocracy commented 7 months ago

I don't know. I've never used .NET. Search the .NET docs "retrieve raw json body of http request"

MazahirA commented 7 months ago

Thank you for the time and help.

MazahirA commented 7 months ago

Resolved. The data arrives in the body and we have to read the raw JSON, and use required properties. In addition to that we can customize the desired properties in the 'params' to easily get it. Thank you @christocracy for the help.