title: Android Geofence Not Triggering, Causing GPS Activity, or Calling IntentService
body: <p>So I've followed the documentation I found here: <a href="https://developer.android.com/training/location/geofencing.html" rel="nofollow">https://developer.android.com/training/location/geofencing.html</a></p>
  
  <p>After implementing the tutorial I can see that the Geofence I'm testing with has been created and added. I get a success status.</p>
  
  <p>My problem now is: the Geofence is added but my phone is showing no GPS activity and the Geofence isn't triggering the PendingIntent even though its been added successfully.</p>
  
  <p>I declare the service in my manifest:</p>
  
  <pre><code>    &lt;service android:name=".journeytools.TraiNapIntentService"
          android:exported="false"/&gt;
  </code></pre>
  
  <p>And I have the following permission:</p>
  
  <pre><code>&lt;uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/&gt;
  </code></pre>
  
  <p>The class adding the Geofence is:</p>
  
  <pre><code>public class SplashScreen extends Activity implements View.OnClickListener, ResultCallback&lt;Status&gt;,
      GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
  
  TextView miles, push, alarm;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
  
      setContentView(R.layout.splash_screen);
  
      buildGoogleApiClient();
      System.out.println("Building Google Api Client");
  
      if (GooglePlayServicesUtil.isGooglePlayServicesAvailable(getApplicationContext())
              != ConnectionResult.SUCCESS) {
          //TODO Add something to post a message to the screen that the service isn't available
          System.out.println("Service not Available");
      } else {
          System.out.println("Service Available");
          miles = (TextView) findViewById(R.id.tvmiles);
  
          push = (TextView) findViewById(R.id.tvpush);
  
          alarm = (TextView) findViewById(R.id.tvalarm);
  
          Button button = (Button)findViewById(R.id.button);
  
          button.setOnClickListener(this);
      }
  }
  
  ArrayList geoFenceList;
  PendingIntent geoFencePendingIntent = null;
  
  /**
   * Provides the entry point to Google Play services.
   */
  protected GoogleApiClient mGoogleApiClient;
  
  @Override
  public void onClick(View v) {
  
      System.out.println("Onclick pressed");
  
      DataGather data = new DataGather();
  
      data.writePreferences(this, 5, false, true);
      data.writeRecentJourney(this, "Wareham", "Poole");
  
      double longitude = data.getGoingToLong(getBaseContext());
      double latitude = data.getGoingToLat(getBaseContext());
      float proximity = getProximity();
  
      /*
       * Add the geofence work.
       */
  
      geoFenceList = new ArrayList();
  
      geoFenceList.add(
              new Geofence.Builder()
  
                      .setRequestId("Testing the addition")
  
                      .setCircularRegion(
                              latitude,
                              longitude,
                              proximity)
  
                      .setExpirationDuration(Geofence.NEVER_EXPIRE)
  
                      .setTransitionTypes(Geofence.GEOFENCE_TRANSITION_ENTER)
  
                      .build()
      );
  
      System.out.println("Added Geofence to Arraylist");
  
      LocationServices.GeofencingApi.addGeofences(
          mGoogleApiClient,
          getGeofencingRequest(),
          getGeofencePendingIntent()
      ).setResultCallback(this);
  
      System.out.println("Added GeoFence");
  
  }
  
  @Override
  protected void onStart() {
      super.onStart();
      mGoogleApiClient.connect();
  }
  
  @Override
  protected void onStop() {
      super.onStop();
      mGoogleApiClient.disconnect();
  }
  
  /**
   * Builds a GoogleApiClient. Uses the {@code #addApi} method to request the LocationServices API.
   */
  protected synchronized void buildGoogleApiClient() {
      mGoogleApiClient = new GoogleApiClient.Builder(this)
              .addConnectionCallbacks(this)
              .addOnConnectionFailedListener(this)
              .addApi(LocationServices.API)
              .build();
  }
  
  private GeofencingRequest getGeofencingRequest() {
      GeofencingRequest.Builder geoFencingRequestBuilder = new GeofencingRequest.Builder();
  
      geoFencingRequestBuilder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER);
  
      geoFencingRequestBuilder.addGeofences(geoFenceList);
  
      System.out.println("Returning geoFencingRequestBuilder.build()");
  
      return geoFencingRequestBuilder.build();
  }
  
  /**
   * Uses the users inserted information to derive the proximity setting.
   * @return Returns a float of the proximity number.
   */
  private float getProximity(){
  
      DataGather dataGather = new DataGather();
  
      String[] prefs = dataGather.getPreferences(this);
  
      System.out.println("Returning Float" + Float.parseFloat(prefs[0]) * 1609.344);
  
      return (float) (Float.parseFloat(prefs[0]) * 1609.344);
  }
  
  private PendingIntent getGeofencePendingIntent(){
  
      Intent intent = new Intent(this, TraiNapIntentService.class);
  
      System.out.println("Returning PendingIntent.getSerivce");
  
      return PendingIntent.getService(this, 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
  
  }
  
  /**
   * TODO Finish this method
   * @param status
   */
  public void onResult(Status status) {
      if (status.isSuccess()) {
          System.out.println("Success status received");
      } else {
          System.out.println("Non-Success status received");
      }
  }
  
  /**
   * TODO Finish this method
   * @param bundle
   */
  @Override
  public void onConnected(Bundle bundle) {
      System.out.println("onConnected");
  }
  
  /**
   * TODO Finish this method
   * @param i
   */
  @Override
  public void onConnectionSuspended(int i) {
      System.out.println("onConnectionSuspended");
  }
  
  /**
   * TODO Finish this method
   * @param connectionResult
   */
  @Override
  public void onConnectionFailed(ConnectionResult connectionResult) {
      System.out.println("Connection Failed");
  }
  }
  </code></pre>
  
  <p>My code doesn't reach the IntentService so I haven't posted it up but I can if anyone is in need.</p>
  
  <p>Any ideas on whats missing?</p>