HaylLtd / cordova-background-geolocation-plugin

Background and foreground geolocation plugin for Cordova.
Apache License 2.0
57 stars 66 forks source link

How to send Cookies with HTTP Location Posting #165

Closed MazahirA closed 1 year ago

MazahirA commented 1 year ago

I'm using HTTP Location Posting to send data to my server. The customized data using postTemplate is successfully receiving to the server, but it's not sending cookies. How can we send cookies using the plugin?

HarelM commented 1 year ago

Using httpHeaders...?

MazahirA commented 1 year ago

By any mean. Using httpheaders or by customizing the plugin's java files like the 'HttpPostService.java' ? The goal is to send cookies along with the http location posting request.

HarelM commented 1 year ago

So use httpHeaders configuration option.

MazahirA commented 1 year ago

Can you explain how can we do that? Additionally, can we customize 'HttpPostService.java' file for this purpose as well?

HarelM commented 1 year ago

Feel free to read the docs: https://haylltd.github.io/cordova-background-geolocation-plugin/api.html

You are welcome to do anything in a fork and use that, I'm not sure what you are suggesting here though...

MazahirA commented 1 year ago

Thank you for the help. In my scenario, I'm sending latitude and longitude to the server. But there's an authorization check before persisting data to the DB. That's why I need the cookie data to be send to the server when an HTTP Location Posting happens.
Currently, it seems that the cookies aren't receiving to the server when I use HTTP Location Posting config. Therefore, I'm looking for ways to send cookies as well.

MazahirA commented 1 year ago

I have customized the 'HttpPostService.java' file, and it's sending cookies now.