title: Android Getting user location latitude and longitude using the GoogleApiClient
body: <p>I am working on getting the user's latitude and longitude using the GoogleApiClient and this is what I have done so far. I followed the Udacity tutorial on Google Maps to do this. I have done exactly as it showed on Udacity but my latitude and longitude are not displaying like it does for the instrutor.</p>
  
  <p>There are no errors, so I am not able to see where the mistake is.
  I have Google Play Services version 10.2.0 installed and entered that in the dependencies section of the build.gradle app. <br>
  Any help is much appreciated.</p>
  
  <pre><code>package com.example.udacitylocation;
  
  import android.content.pm.PackageManager;
  import android.location.Location;
  import android.support.annotation.NonNull;
  import android.support.annotation.Nullable;
  import android.support.v4.app.ActivityCompat;
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.widget.TextView;
  
  import com.google.android.gms.common.ConnectionResult;
  import com.google.android.gms.common.api.GoogleApiClient;
  import com.google.android.gms.location.LocationServices;
  import com.google.android.gms.location.LocationRequest;
  
  public class MainActivity extends AppCompatActivity implements
      GoogleApiClient.ConnectionCallbacks,
      GoogleApiClient.OnConnectionFailedListener,
      com.google.android.gms.location.LocationListener
  {
  private final String LOG_TAG = "LaurenceTestApp";
  private TextView txtOutput;
  private GoogleApiClient mGoogleApiClient;
  private LocationRequest mLocationRequest;
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mGoogleApiClient = new GoogleApiClient.Builder(this)
              .addApi(LocationServices.API)
              .addConnectionCallbacks(this)
              .addOnConnectionFailedListener(this)
              .build();
      txtOutput = (TextView) findViewById(R.id.txtOutput);
  }
  
  
  @Override
  public void onConnected(@Nullable Bundle bundle)
  {
      mLocationRequest = LocationRequest.create(); // Another way to write a new object
      mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
      mLocationRequest.setInterval(10); // Always write in milliseconds
  
      if (ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED &amp;&amp; ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED)
      {
          return;
      }
      LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
  }
  
  @Override
  public void onLocationChanged(Location location)
  {
      Log.i(LOG_TAG, location.toString());
      txtOutput.setText(location.toString());
  }
  
  @Override
  public void onConnectionSuspended(int i)
  {
      Log.i(LOG_TAG, "GoogleApiClient connection has been suspended");
  }
  
  @Override
  public void onConnectionFailed(ConnectionResult connectionResult)
  {
      Log.i(LOG_TAG, "GoogleApiClient connection has failed");
  }
  
  @Override
  protected void onStart()
  {
      super.onStart();
      mGoogleApiClient.connect();
  }
  
  @Override
  protected void onStop()
  {
      mGoogleApiClient.disconnect();
      super.onStop();
  }
  }
  </code></pre>
  
  <p>XML File</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:id="@+id/activity_main"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:paddingBottom="@dimen/activity_vertical_margin"
  android:paddingLeft="@dimen/activity_horizontal_margin"
  android:paddingRight="@dimen/activity_horizontal_margin"
  android:paddingTop="@dimen/activity_vertical_margin"
  tools:context="com.example.udacitylocation.MainActivity"&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:id="@+id/txtOutput"
      android:text="Location Goes Here"/&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>AndroidManifest.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.udacitylocation"&gt;
  
  &lt;application
      android:allowBackup="true"
      android:icon="@mipmap/ic_launcher"
      android:label="@string/app_name"
      android:supportsRtl="true"
      android:theme="@style/AppTheme"&gt;
      &lt;meta-data android:name="com.google.android.gms.version" 
      android:value="@integer/google_play_services_version"/&gt;
  
      &lt;activity android:name=".MainActivity"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"/&gt;
  
              &lt;category android:name="android.intent.category.LAUNCHER"/&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
  &lt;/application&gt;
  
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  
  &lt;/manifest&gt;
  </code></pre>