
PhoneGap.exec("Location.start", args);
- (void)start:(NSMutableArray*)arguments
withDict:(NSMutableDictionary*)options;
NSString * jsCallBack =
[NSString stringWithFormat:
@"navigator.geolocation.setLocation({ timestamp: %d, %@ });",
epoch,
coords];
[webView stringByEvaluatingJavaScriptFromString:jsCallBack];
Geolocation.prototype.setLocation = function(position) {
this.lastPosition = position;
for (var i = 0; i < this.callbacks.onLocationChanged.length; i++) {
var f = this.callbacks.onLocationChanged.shift();
f(position);
}
};
gap = new PhoneGap(this, appView);
geo = new GeoBroker(appView, this);
accel = new AccelListener(this, appView);
// This creates the new javascript interfaces for PhoneGap
appView.addJavascriptInterface(gap, "Device");
appView.addJavascriptInterface(geo, "Geo");
appView.addJavascriptInterface(accel, "Accel");
mAppView.loadUrl("
javascript:Geolocation.gotCurrentPosition(" + loc.getLatitude() + ", " + loc.getLongitude() + ")
");
Geolocation.gotCurrentPosition = function(lat, lng) {
if (lat == "undefined" || lng == "undefined") {
this.fail();
} else {
p = {};
p.latitude = lat;
p.longitude = lng;
this.global_success(p);
}
}

exec: function(command, params, sync) {
if (Device.available || command == "initialize") {
try {
var url = "gap://" + command;
if (params) url += "/" + params.join("/");
document.location = url;
} catch(e) { ... }
}
},
poll: function(callback) {
eval(document.cookie + (callback ? ";callback();" : ""));
},
public String getHTTPCookie(String url) {
StringBuffer responseCode = new StringBuffer();
synchronized (pendingResponses) {
for (int index = 0; index < pendingResponses.size(); index++)
responseCode.append(pendingResponses.elementAt(index));
pendingResponses.removeAllElements();
}
return responseCode.toString();
}
