Code example for LocationClient

Methods: getLastLocation

0
     * @return A String representation of the coordinates of a point (latitude and longitude). 
     */ 
    public String getCoordinates() {
        Location location;
        if (servicesConnected()) { 
            location = mLocationClient.getLastLocation();
        } else { 
            Toast.makeText(context, "No location found", Toast.LENGTH_SHORT).show();
            return ""; 
        } 
 
        return location.getLatitude() + "," + location.getLongitude();
    } 
 
    /** 
     * Checks if the Google Play services are connected. 
     * 
     * @return <b>true</b> if the Play services are connected, <b>false</b> otherwise 
     */ 
    private boolean servicesConnected() { 
        // Check that Google Play services is available