/[projects]/android/TrainInfo/src/dk/thoerup/traininfo/StationLocator.java
ViewVC logotype

Diff of /android/TrainInfo/src/dk/thoerup/traininfo/StationLocator.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 254 by torben, Mon Aug 10 17:01:02 2009 UTC revision 285 by torben, Fri Aug 28 06:34:42 2009 UTC
# Line 36  public class StationLocator implements L Line 36  public class StationLocator implements L
36          public void abortLocationListener() {          public void abortLocationListener() {
37                  locManager.removeUpdates(this);                  locManager.removeUpdates(this);
38          }          }
39            
40            public boolean hasLocation() {
41                    return savedLocation != null;
42            }
43    
44          public void locateStations() {          public void locateStations() {
45                  //http://www.google.com/uds/GlocalSearch?callback=google.search.LocalSearch.RawCompletion&context=1&lstkp=0&rsz=small&hl=en&source=gsc&gss=.com&sig=fadf0e8d483d0f70bea11d5905010a16&q=Train%20station&near=56.377424%2C9.656695&key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q&v=1.0&nocache=1249640467498                  //http://www.google.com/uds/GlocalSearch?callback=google.search.LocalSearch.RawCompletion&context=1&lstkp=0&rsz=small&hl=en&source=gsc&gss=.com&sig=fadf0e8d483d0f70bea11d5905010a16&q=Train%20station&near=56.377424%2C9.656695&key=ABQIAAAA1XbMiDxx_BTCY2_FkPh06RRaGTYH6UMl8mADNa0YKuWNNa8VNxQEerTAUcfkyrr6OwBovxn7TDAH5Q&v=1.0&nocache=1249640467498
# Line 58  public class StationLocator implements L Line 62  public class StationLocator implements L
62                                    
63    
64                  if (bestProv != null) {                  if (bestProv != null) {
                         savedLocation = locManager.getLastKnownLocation(bestProv);  
65                          locManager.requestLocationUpdates(bestProv, 0, 0, this);                          locManager.requestLocationUpdates(bestProv, 0, 0, this);
66                  } else {                  } else {
67                          // message that no suitable provider was found                          // message that no suitable provider was found
# Line 126  public class StationLocator implements L Line 129  public class StationLocator implements L
129                  bjbro.setLatitude(56.380745);                  bjbro.setLatitude(56.380745);
130                  bjbro.setLongitude(9.655609);                  bjbro.setLongitude(9.655609);
131                                    
132                    Location hillerod = new Location("gps");
133                    hillerod.setLatitude(55.929177);
134                    hillerod.setLongitude(12.308095);
135                                    
136                  LocationManager lm = (LocationManager) cntx.getSystemService(Context.LOCATION_SERVICE);                  LocationManager lm = (LocationManager) cntx.getSystemService(Context.LOCATION_SERVICE);
137                  if (lm.getProvider("gps2") == null)                  if (lm.getProvider("gps2") == null)
138                          lm.addTestProvider("gps2", false, true, true, false, false, false, false, 0, Criteria.ACCURACY_FINE );                          lm.addTestProvider("gps2", false, true, true, false, false, false, false, 0, Criteria.ACCURACY_FINE );
139                  lm.setTestProviderEnabled("gps2", true);                  lm.setTestProviderEnabled("gps2", true);
140                  lm.setTestProviderLocation("gps2", kbh);                  lm.setTestProviderLocation("gps2", hillerod);
141          }          }
142                    
143          public static void removeMockLocation(Context cntx) {          public static void removeMockLocation(Context cntx) {

Legend:
Removed from v.254  
changed lines
  Added in v.285

  ViewVC Help
Powered by ViewVC 1.1.20