2009-11-09 17:45:02 -08:00
|
|
|
package com.phonegap;
|
2009-04-01 16:56:43 -07:00
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.webkit.WebView;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This class is the interface to the Geolocation. It's bound to the geo object.
|
|
|
|
*
|
|
|
|
* This class only starts and stops various GeoListeners, which consist of a GPS and a Network Listener
|
|
|
|
*/
|
|
|
|
|
|
|
|
public class GeoBroker {
|
|
|
|
private WebView mAppView;
|
|
|
|
private Context mCtx;
|
|
|
|
private HashMap<String, GeoListener> geoListeners;
|
2009-12-15 15:16:35 -08:00
|
|
|
private GeoListener listener;
|
2009-04-01 16:56:43 -07:00
|
|
|
|
2009-11-23 10:57:05 -08:00
|
|
|
public GeoBroker(WebView view, Context ctx)
|
2009-04-01 16:56:43 -07:00
|
|
|
{
|
|
|
|
mCtx = ctx;
|
|
|
|
mAppView = view;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void getCurrentLocation()
|
2009-12-15 15:16:35 -08:00
|
|
|
{
|
|
|
|
if (listener == null)
|
|
|
|
listener = new GeoListener("global", mCtx, 10000, mAppView);
|
2009-04-01 16:56:43 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
public String start(int freq, String key)
|
|
|
|
{
|
|
|
|
GeoListener listener = new GeoListener(key, mCtx, freq, mAppView);
|
|
|
|
geoListeners.put(key, listener);
|
|
|
|
return key;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void stop(String key)
|
|
|
|
{
|
|
|
|
GeoListener geo = geoListeners.get(key);
|
|
|
|
}
|
|
|
|
}
|