title: Finding current location of the user in Android
body: <p>I am new to Android and I am trying to develop an Android app which shows current location of the user. I am using Genymotion. Now I am using </p>
  
  <pre><code>mLocation=LocationServices.FusedLocationApi.getLastLocation(mGoogleClient); 
  </code></pre>
  
  <p>to get the last location of the device. The thing is I wanted to get the current location but with this I get <code>mlocation</code> as not null that's fine. But in the map it shows last location of the device always not the current location.</p>
  
  <p><strong>code snippet</strong></p>
  
  <pre><code>@Override
  public void onConnected(Bundle bundle) {
      Log.i(TAG, "inside onconnected Location services connected");
      Location mLocation=null;
      mLocationRequest= new LocationRequest();
      mLocationRequest.setInterval(10 * 1000)    ;   
      mLocationRequest.setFastestInterval(1 * 1000);mLocationRequest.setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
      if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
          PackageManager.PERMISSION_GRANTED &amp;&amp;
          ActivityCompat.checkSelfPermission(this,
          Manifest.permission.ACCESS_COARSE_LOCATION) !=
          PackageManager.PERMISSION_GRANTED) {
  
      }
                 mLocation=LocationServices.FusedLocationApi.getLastLocation(mGoogleClient);
      if(mLocation==null)
      {
          Log.d("***Inside mlocation***", "***mlocation is null here");
      }
  
      if (mLocation != null) {
          onLocationChanged(mLocation);
      }
      LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleClient, mLocationRequest, this);
  }
  
  @Override
  public void onLocationChanged(Location location) {
      double currentLatitude = location.getLatitude();
      double currentLongitude = location.getLongitude();
      LatLng latLng = new LatLng(currentLatitude,currentLongitude);
      MarkerOptions options = new MarkerOptions()
              .position(latLng)
              .title("Im here!");
  
      mMap.addMarker(options);
      mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
  }
  </code></pre>
  
  <p>and in <code>onstart()</code> I called <code>googleapi.connect()</code> and I used <code>setUpMapIfNeeded()</code> appropriately.</p>
  
  <p>Please tell me whats the problem in this code. I am trying this for 3 days. </p>