title: Android Wear Location
body: <p>I am making an Android Wear Watch Face and I need to show user current location.</p>
  
  <p>I was followed tutorial on <a href="https://developer.android.com/training/articles/wear-location-detection.html" rel="nofollow noreferrer">Dev site</a>, but I can't get it to work. The code never goes to <strong>"onLocationChanged"</strong> listener.</p>
  
  <p>Device is Huawei watch, and it is connected to mobile with WiFi and Location on.</p>
  
  <p>Permissions are on (I have runtime permission request). Here is the code:</p>
  
  <p><strong>AndroidManifest.xml</strong></p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  &lt;uses-permission android:name="android.permission.INTERNET"/&gt;
  </code></pre>
  
  <p><strong>build.gradle (Module.wear)</strong></p>
  
  <pre><code>compile 'com.google.android.gms:play-services-location:8.4.0'
  </code></pre>
  
  <p><strong>AnalogFaceService.java</strong></p>
  
  <pre><code>googleApiClient = new GoogleApiClient.Builder(AnalogFaceService.this)
    .addApi(LocationServices.API)
    .addApi(Wearable.API)
    .addConnectionCallbacks(this)
    .addOnConnectionFailedListener(this).build();
  
  @Override
  public void onConnected(@Nullable Bundle bundle)
  {
    LocationRequest locationRequest = LocationRequest.create()
     .setPriority(LocationRequest.PRIORITY_BALANCED_POWER_ACCURACY)
     .setInterval(TimeUnit.SECONDS.toMillis(2))
     .setFastestInterval(TimeUnit.SECONDS.toMillis(2))
     .setSmallestDisplacement(2);
  
    if
    (
      (
        ActivityCompat.checkSelfPermission(AnalogFaceService.this, Manifest.permission.ACCESS_FINE_LOCATION) 
        != PackageManager.PERMISSION_GRANTED
       ) &amp;&amp; (
        ActivityCompat.checkSelfPermission(AnalogFaceService.this, Manifest.permission.ACCESS_COARSE_LOCATION) 
        != PackageManager.PERMISSION_GRANTED
       )
      ) {
        return;
      }
  
    LocationServices.FusedLocationApi
     .requestLocationUpdates(googleApiClient, locationRequest, onLocationChangedListener)
     .setResultCallback(locationCallback);
  }
  
  private final LocationListener onLocationChangedListener = new LocationListener()
  {
    @Override
    public void onLocationChanged(Location location)
    {
      Log.v("LOCATION_TEST", location.getLatitude() + " :::: " + location.getLongitude());
      getSunriseAndSunset(location);
  
      addLocationEntry(location.getLatitude(), location.getLongitude());
    }
  };
  </code></pre>