How to get Android Geofence.GEOFENCE_TRANSITION_DWELL trigger every 5minutes when user dwells in a geofence
<p>I tried setting initial trigger to INITIAL_TRIGGER_ENTER as well as INITIAL_TRIGGER_DWELL. Whichever i set , that trigger will be called once and i get one notification. </p>

<pre><code>private GeofencingRequest getGeofencingRequest() {
    GeofencingRequest.Builder builder = new GeofencingRequest.Builder();
    builder.setInitialTrigger(GeofencingRequest.INITIAL_TRIGGER_ENTER);
    builder.addGeofences(mGeofenceList);
    return builder.build();
}
</code></pre>

<p>I also added  setLoiteringDelay(5000) for 5 second delay. 
As per the documentation-</p>

<blockquote>
  <p>Sets the delay between GEOFENCE_TRANSITION_ENTER and
  GEOFENCE_TRANSITION_DWELLING in milliseconds. For example, if
  loitering delay is set to 300000 ms (i.e. 5 minutes) the geofence
  service will send a GEOFENCE_TRANSITION_DWELL alert roughly 5 minutes
  after user enters a geofence if the user stays inside the geofence
  during this period of time. If the user exits from the geofence in
  this amount of time, GEOFENCE_TRANSITION_DWELL alert won't be sent.</p>
</blockquote>

<p>Correct me if i am wrong, from my understanding setting this should trigger every 5minutes. I have set to 5 seconds, so it is supposed to trigger dwell event every 5 seconds. Am I missing something here? Please let me know thank you. </p>

<p><strong>Update:</strong></p>

<p>I searched all over the net for couple of days but this is what i could find as of now. This may not be right way of doing but it does what it is supposed to do.</p>

<p>Check the sample project which i have created- <a href="https://github.com/SkyTreasure/am-i-in-the-geofencing" rel="nofollow noreferrer">https://github.com/SkyTreasure/am-i-in-the-geofencing</a></p>

<p>Let me know if anyone finds a better solution.</p>