Closed MazahirA closed 1 year ago
Your best bet would be to debug this using a simulator or an actual device connected to the dev machine. From a short inspection the configuration looks OK.
On debugging with actual device connected to the dev machine, it's showing no error in the console. It's hitting the server, but sending no data. Additionally, the post request isn't showing in the network.
Maybe something problematic with the http library, try changing the code there and see what changes...
I'm new to app development. Can you explain it please?
You'll need to open Android studio, open the app and try to debug it, try to see what it receive just before sending. You should be able to find online details on how to do that.
Logcat results:
Location change: Location[ fused 100.99, 35.33 ] New location BGLocation[ fused 100.99, 35.33 ] Posting json to url: http://abc/controller/testMethod headers: {Content-Type=application/json}
Thank you @HarelM for this plugin, and the prompt help. The plugin sends data in the body of requested URL, in the form of JSON array. Therefore, we need to adjust our server side code to read it and use as desired.
The plugin is hitting the server, but sending no data (postTemplate) with it. Platform cordova-android@12, Targetting android@13, Testing on android@12.
Everything is working well, but not sending data along with the URL.
The configuration: BackgroundGeolocation.configure({ locationProvider: BackgroundGeolocation.DISTANCE_FILTER_PROVIDER, desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY, debug: true, url: 'http://197.169.5.155/abc/controller/TestMethod', postTemplate: { lat:'@latitude', lon:'@longitude' } });
The log: POST /domain/controller/TestMethod - 80 - 195.178.8.99 Dalvik/2.1.0+(Android+12;) - 500
The log with Postman: POST /abc/controller/TestMethod/ postTemplate=[lat:22,lon:32] 80 - 194.188.3.231 PostmanRuntime/7.33.0 - 500 0 0 27150
I have tested the API with Postman and it's working well. What I expect is; the plugin should send/attach the data along with the URL.
The log with Postman: POST /abc/controller/TestMethod/ postTemplate=[lat:22,lon:32] 80 - 194.188.3.231 PostmanRuntime/7.33.0 - 500 0 0 27150