Android Location - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android Location class.

This code example shows how to use the following methods: getLatitude
	 
	private boolean isDiff(Location loc){
 
		if(result == null) return true; 
		 
		float diff = distFrom(result.getLatitude(), result.getLongitude(), loc.getLatitude(), loc.getLongitude());
		 
		if(diff < tolerance){
			AQUtility.debug("duplicate location"); 
			return false; 
		}else{ 
			return true; 
		} 
	} 
	 
	 
	private boolean isBetter(Location loc){
		 
		if(result == null) return true; 
		 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLatitude, getLongitude
   
  LocationListener onLocation=new LocationListener() {
    public void onLocationChanged(Location location) { 
      StringBuilder buf=new StringBuilder("javascript:whereami("); 
       
      buf.append(String.valueOf(location.getLatitude())); 
      buf.append(","); 
      buf.append(String.valueOf(location.getLongitude())); 
      buf.append(")"); 
       
      browser.loadUrl(buf.toString()); 
    } 
     
    public void onProviderDisabled(String provider) { 
      // required for interface, not used 
    } 
     
    public void onProviderEnabled(String provider) { 
      // required for interface, not used 
    } 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLatitude, getLongitude
		return new Point(aGP.getLongitudeE6(), aGP.getLatitudeE6());
	} 
 
	/** Converts an {@link Location} to an {@link Point}. */ 
	public static Point location2Point(final Location aLocation){
		return new Point((int) (aLocation.getLongitude() * 1E6),
				(int) (aLocation.getLatitude() * 1E6));
	} 
 
	/** Converts an {@link Location} to a {@link GeoPoint}. */ 
	public static GeoPoint location2GeoPoint(final Location aLocation){
		return new GeoPoint((int) (aLocation.getLatitude() * 1E6),
				(int) (aLocation.getLongitude() * 1E6));
	} 
 
	/** 
	 * Calculates the bearing of the two Locations supplied and returns the 
	 * Angle in the following (GPS-likely) manner: <br /> 
	 * <code>N:0°, E:90°, S:180°, W:270°</code> 
	 */ 
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getAltitude, getBearing, getLatitude, getLongitude, getSpeed
	 
 
    public void onLocationChanged(Location location) {
      // Called when a new location is found by the network location provider. 
      //makeUseOfNewLocation(location); 
    	locationChanged(location.getAltitude(),location.getLatitude(),location.getLongitude(),location.getSpeed(),location.getBearing());
    } 
 
 
    public void onProviderEnabled(String provider) {}
 
    public void onProviderDisabled(String provider) {}
 
	public void onStatusChanged(String provider, int status, Bundle extras) {
		// TODO Auto-generated method stub 
		 
	} 
	 
	 
	public static native void locationChanged(double altitude, double latitude, double longitude, float speed, float bearing);
Full Snippet Info
9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getLatitude, getLongitude
        Location location = ((LocationManager) getActivity().getSystemService(Context.LOCATION_SERVICE)).getLastKnownLocation("gps");
        return locationToLatLng(location);
    } 
 
    private LatLng locationToLatLng(Location location) {
        return new LatLng(location.getLatitude(), location.getLongitude());
    } 
 
} 
Full Snippet Info
10
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android Location Questions & Answers:

Other Android Location Examples

30:	    Criteria criteria = new Criteria();
31:	    provider = locationManager.getBestProvider(criteria, false);
32:	    Location location = locationManager.getLastKnownLocation(provider);
33:	
34:	    // Initialize the location fields
-
57:	
58:	  @Override
59:	  public void onLocationChanged(Location location) {
60:	    int lat = (int) (location.getLatitude());
61:	    int lng = (int) (location.getLongitude());

Read More

0:	public Location getLocation() {
1:			try {
2:				locationManager = (LocationManager) mContext
-
58:		}
59:		@Override
60:		public void onLocationChanged(Location location) {
61:		}
62:

Read More

26:		boolean canGetLocation = false;
27:	
28:		Location location = null; // location
29:		double latitude; // latitude
30:		double longitude; // longitude
-
44:		}
45:	
46:		public Location getLocation() {
47:			try {
48:				locationManager = (LocationManager) mContext
-
183:	
184:		@Override
185:		public void onLocationChanged(Location location) {
186:		}
187:

Read More

26:		boolean canGetLocation = false;
27:	
28:		Location location; // location
29:		double latitude; // latitude
30:		double longitude; // longitude
-
44:		}
45:	
46:		public Location getLocation() {
47:			try {
48:				locationManager = (LocationManager) mContext
-
179:	
180:		@Override
181:		public void onLocationChanged(Location location) {
182:		}
183:

Read More

See Code Examples for Android Location Methods: