title: Android wear: geofence - ApiException: 1000
body: <p>I am building an Android app for <strong>Android Wear</strong>. For battery savings I am trying to use Geofences to track if you enter or exit a location. But I cannot get it working.</p>
  
  <p><strong>First of all I am not sure if Geofences are supported on Android Wear? (Standalone?)</strong> I have a Huawei watch 2 LTE which contains a GPS antenne, and <strong>I already got the FusedLocationClient working so I know the GPS works.</strong> I also got my geofencing code working on the phone with no problems.</p>
  
  <p><strong>When I run the code I get the following exception:</strong></p>
  
  <pre><code>com.google.android.gms.common.api.ApiException: 1000:
  </code></pre>
  
  <p>I found on the <a href="https://developers.google.com/android/reference/com/google/android/gms/location/GeofenceStatusCodes" rel="noreferrer">Google API documentation</a> that this means:   <code>GEOFENCE_NOT_AVAILABLE</code> which gives me no extra info.</p>
  
  <p>This is the service I wrote to start and create the geofence:</p>
  
  <pre><code>public class GeofencingService extends Service implements OnSuccessListener, OnFailureListener {
  
      private static final String TAG = "GeofencingService";
      private static final int NOTIFICATION_ID = 1;
  
      private GeofencingClient mGeofencingClient;
      private List&lt;Geofence&gt; mGeofenceList;
      private NotificationManager mNotificationManager;
  
      @Nullable
      @Override
      public IBinder onBind(Intent intent) {
  
          return null;
      }
  
      @Override
      public void onCreate() {
          super.onCreate();
  
          mNotificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
          mGeofencingClient = LocationServices.getGeofencingClient(this);
          mGeofenceList = new ArrayList&lt;&gt;();
          createGeofences();
      }
  
      @Override
      public int onStartCommand(Intent intent, int flags, int startId) {
          showNofification();
          setupGeofence();
          return super.onStartCommand(intent, flags, startId);
      }
  
      @Override
      public void onDestroy() {
          super.onDestroy();
          mNotificationManager.cancel(NOTIFICATION_ID);
      }
  
      private PendingIntent getGeofencePendingIntent()
      {
          Intent intent = new Intent(this, GeofenceBroadcastReceiver.class);
          return PendingIntent.getBroadcast(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
      }
  
      private GeofencingRequest getGeofencingRequest() {
          GeofencingRequest.Builder builder = new GeofencingRequest.Builder();
  
          // The INITIAL_TRIGGER_ENTER flag indicates that geofencing service should trigger a
          // GEOFENCE_TRANSITION_ENTER notification when the geofence is added and if the device
          // is already inside that geofence.
          builder.setInitialTrigger(INITIAL_TRIGGER_ENTER | INITIAL_TRIGGER_EXIT);
  
          // Add the geofences to be monitored by geofencing service.
          builder.addGeofences(mGeofenceList);
  
          // Return a GeofencingRequest.
          return builder.build();
      }
  
      private void setupGeofence()
      {
          try{
              Log.i(TAG, "Setting up geofences...");
              mGeofencingClient.addGeofences(getGeofencingRequest(), getGeofencePendingIntent()).addOnSuccessListener(this).addOnFailureListener(this);
          } catch (SecurityException ex)
          {
              Log.d(TAG, "Exception: " + ex.getMessage());
          }
      }
  
      private void createGeofences()
      {
          Log.i(TAG, "Creating geofence...");
          mGeofenceList.add(new Geofence.Builder()
                  // Set the request ID of the geofence. This is a string to identify this
                  // geofence.
                  .setRequestId("Test1")
                  // Set the circular region of this geofence.
                  .setCircularRegion(
                          50.03535,
                          4.33139,
                          100
                  )
                  .setExpirationDuration(NEVER_EXPIRE)
                  // Set the transition types of interest. Alerts are only generated for these
                  // transition. We track entry and exit transitions in this sample.
                  .setTransitionTypes(GEOFENCE_TRANSITION_ENTER | GEOFENCE_TRANSITION_EXIT)
                  // Create the geofence.
                  .build());
      }
  
      private void showNofification()
      {
          Intent appIntent = new Intent(this, MainActivity.class);
          PendingIntent contentIntent = PendingIntent.getActivity(this, 0, appIntent, 0);
  
          Notification notification = new NotificationCompat.Builder(this, NotificationCompat.CATEGORY_SERVICE)
                  .setSmallIcon(R.mipmap.ic_launcher)
                  .setContentTitle(getText(R.string.location_service_title))
                  .setContentText(getText(R.string.location_service_text))
                  .setLocalOnly(true)
                  .setOngoing(true)
                  .setContentIntent(contentIntent)
                  .build();
  
          mNotificationManager.notify(NOTIFICATION_ID, notification);
      }
  
      @Override
      public void onFailure(@NonNull Exception e) {
          Log.d(TAG, "Exception: " + e.getMessage());
          new Handler().postDelayed(new Runnable() {
              @Override
              public void run() {
                  setupGeofence();
              }
          }, 2000);
      }
  
      @Override
      public void onSuccess(Object o) {
          Log.d(TAG, "Success!");
      }
  }
  </code></pre>
  
  <p><a href="https://github.com/kevingoos/WearableGeofenceTests" rel="noreferrer">Here is also a github link to the example I wrote.</a></p>
  
  <p>Hopefully somebody can help me figure this out, because I already tried everything I know :)</p>