/** * Called each time we receive a new location notification. - sends the location back to the * LocationReceiver that requested the location. */ public void onLocationChanged(Location loc) { Log.i(TAG, "onLocationChanged() - location found."); if (loc != null) { Log.i(TAG, "OnLocationChanged() - returning Location (" + loc.toString() + ")"); Toast.makeText( mContext, "Location is (" + loc.getLatitude() + "," + loc.getLongitude() + ")", Toast.LENGTH_LONG); LonLat ll; ll = new LonLat( loc.getLongitude(), loc.getLatitude(), loc.getAccuracy(), loc.getProvider(), new Date(loc.getTime())); // Now we have a location, unsubscribe from location updates. LocationServices.FusedLocationApi.removeLocationUpdates(mGoogleApiClient, this); // And retrn the location to the requesting process. lr.onLocationFound(ll); } else { Log.i(TAG, "onLocationChanged() - Location is null????"); Toast.makeText(mContext, "No Location Detected", Toast.LENGTH_LONG).show(); lr.onLocationFound(null); } }
public void onLocationChanged(double lon, double lat, boolean refresh) { Point p = new Point(lon, lat); if (!displayer.isLocationMarker()) displayer.addLocationMarker(p); else displayer.moveLocationMarker(p); cancelGPSWaiting(); receiver.receiveLocation(lon, lat, refresh); }
public void onStatusChanged(String provider, int status, Bundle extras) { switch (status) { case LocationProvider.OUT_OF_SERVICE: case LocationProvider.TEMPORARILY_UNAVAILABLE: hideLocationMarker(); receiver.noGPS(); showGpsWaiting("Waiting for GPS"); break; case LocationProvider.AVAILABLE: showLocationMarker(); cancelGPSWaiting(); break; } }
public void onProviderDisabled(String provider) { hideLocationMarker(); cancelGPSWaiting(); receiver.noGPS(); }