Commit a9999168 authored by Zachary Giles's avatar Zachary Giles

Adding Iterator for headers

parent 7fc5617c
package com.tenforwardconsulting.cordova.bgloc; package com.tenforwardconsulting.cordova.bgloc;
import java.util.List; import java.util.List;
import java.util.Iterator;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
...@@ -664,11 +665,14 @@ public class LocationUpdateService extends Service implements LocationListener { ...@@ -664,11 +665,14 @@ public class LocationUpdateService extends Service implements LocationListener {
StringEntity se = new StringEntity(params.toString()); StringEntity se = new StringEntity(params.toString());
request.setEntity(se); request.setEntity(se);
for (String headkey: headers.keys()) {
//request.setHeader("Accept", "application/json"); Iterator<String> headkeys = headers.keys();
//request.setHeader("Content-type", "application/json"); while( headkeys.hasNext() ){
Log.d(TAG, "Adding Header: " + headkey + " : " + headers.get(headkey)); if(headkeys.next() != null) {
request.setHeader(headkey, headers.get(headkey)); String headkey = (String)headkeys.next();
Log.d(TAG, "Adding Header: " + headkey + " : " + (String)headers.getString(headkey));
request.setHeader(headkey, (String)headers.getString(headkey));
}
} }
Log.d(TAG, "Posting to " + request.getURI().toString()); Log.d(TAG, "Posting to " + request.getURI().toString());
HttpResponse response = httpClient.execute(request); HttpResponse response = httpClient.execute(request);
......
...@@ -14,7 +14,7 @@ module.exports = { ...@@ -14,7 +14,7 @@ module.exports = {
failure || function() {}, failure || function() {},
'BackgroundGeoLocation', 'BackgroundGeoLocation',
'configure', 'configure',
[params, url, stationaryRadius, distanceFilter, locationTimeout, desiredAccuracy, debug]); [params, headers, url, stationaryRadius, distanceFilter, locationTimeout, desiredAccuracy, debug]);
}, },
start: function(success, failure, config) { start: function(success, failure, config) {
exec(success || function() {}, exec(success || function() {},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment