mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Not in line with HTML5 spec, editing
This commit is contained in:
@@ -16,6 +16,7 @@ public class GeoBroker {
|
||||
private WebView mAppView;
|
||||
private Context mCtx;
|
||||
private HashMap<String, GeoListener> geoListeners;
|
||||
private GeoListener global;
|
||||
|
||||
public GeoBroker(WebView view, Context ctx)
|
||||
{
|
||||
@@ -25,13 +26,12 @@ public class GeoBroker {
|
||||
}
|
||||
|
||||
public void getCurrentLocation()
|
||||
{
|
||||
GeoListener listener = new GeoListener("global", mCtx, 10000, mAppView);
|
||||
Location loc = listener.getCurrentLocation();
|
||||
String params = loc.getLatitude() + "," + loc.getLongitude() + ", " + loc.getAltitude() + "," + loc.getAccuracy() + "," + loc.getBearing();
|
||||
params += "," + loc.getSpeed() + "," + loc.getTime();
|
||||
mAppView.loadUrl("javascript:navigator.geolocation.gotCurrentPosition(" + params + ")");
|
||||
listener.stop();
|
||||
{
|
||||
//It's supposed to run async!
|
||||
if(global == null)
|
||||
global = new GeoListener("global", mCtx, 10000, mAppView);
|
||||
else
|
||||
global.start(10000);
|
||||
}
|
||||
|
||||
public String start(int freq, String key)
|
||||
|
||||
Reference in New Issue
Block a user