<li>In your activity's {@link android.app.Activity#onCreate onCreate()} method, create an instance
of <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>
GoogleApiClient</code></a> and add the Location service.
</li>
<li>To gracefully manage the lifecycle of the connection, call <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()">
{@code connect()}</a> in the {@link android.app.Activity#onResume onResume()} method and
<li>Implement the <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onPeerDisconnected(com.google.android.gms.wearable.Node)">
<code>onPeerDisconnected()</code></a> method and handle cases of whether or not the device has
built-in
GPS.
<pre>
public class NodeListenerService extends WearableListenerService {
private static final String TAG = "NodeListenerService";
@Override
public void onPeerDisconnected(Node peer) {
Log.d(TAG, "You have been disconnected.");
if(!hasGPS()) {
// Notify user to bring tethered handset
// Fall back to functionality that does not use location
}
}
...
}
</pre>
</li>
</ol>
For more information, read the <a href="{@docRoot}training/wearables/data-layer/events.html#Listen">
Listen for Data Layer Events</a> guide.
<h2 id="Notify">Handle Location Not Found</h2>
<p>When the GPS signal is lost, you can still retrieve the last known location using