First of all, I wanted to indicate that I am more of a web developper than Java, and therefore thats why I am struggling right now.
I am trying to have a background service sending location every X minutes (let's say 15 minutes) alongside my main Phonegap hybrid app.
I started by using the demo background location plugin here https://github.com/Red-Folder/bgs-sample
I just added this part in the "DoWork()" part of this code https://github.com/Red-Folder/bgs-sample/blob/master/src/android/MyService.java to see if my server responds well and all is fine.
try {
httpClient = new DefaultHttpClient();
getMethod = new HttpGet("http://myserver/test.php?user=bla"+ jsonArray.toString());
response = httpClient.execute(getMethod);
} .... catch etc...
Now, the idea was to add the fetch the geolocation in the same time and send it to the server. Coming from web, I thought it would be as easy as HTML5 geolocation but boy I was wrong.
I tryed to implement bunch of stuff, such as this one :
Run Gps as background service and send coordinates to web server (PHP)
But no success...
My question is really, starting from the plugin Sample, what should I had and where to fetch and send the geolocation (could be NETWORK, don't really have to be GPS precise as I am looking for battery saving geolocation every X minutes).
Bear in mind I am not a Java expert (at least I thought it would be easier but it is the first time I am struggling with some code, and as such it is my first question here).
I still need to be able to start/stop the service from the javascript with the regular functions of the plugins (it is user choosing based).
Thanks so much for your help, I know it is some duplicate questions, but no answer truly resolved my issues in the global.