I am trying to create a basic wearable app which accepts new bitmaps from the main android application. Unfortunately, when I try to .build() the GoogleApiClient I the connection failed listener is called with an error code 16.
This is the exact error received from the ConnectionFailedListener
03-21 13:36:35.903 3089-3089/com.example.android.wearable.watchface D/Watch Face Config﹕ onConnectionFailed: ConnectionResult{statusCode=unknown status code 16, resolution=null}
App Code:
// create the api client to allow sending information to the wearable
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
@Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected: " + connectionHint);
// Now you can use the Data Layer API
}
@Override
public void onConnectionSuspended(int cause) {
Log.d(TAG, "onConnectionSuspended: " + cause);
}
})
.addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.d(TAG, "onConnectionFailed: " + result);
}
})
// Request access only to the Wearable API
.addApi(Wearable.API)
.build();
In the wearable app I have a DataListenerService created, but it doesn't matter at the moment because the API is not build correctly.
Thanks for any assistance or comments!!
UPDATE - I changed the emulator device target from Google APIs to Android 5.0.1 and the error changed to:
03-21 14:18:24.620 3025-3025/com.example.android.wearable.watchface D/Watch Face Config﹕ onConnectionFailed: ConnectionResult{statusCode=SERVICE_MISSING, resolution=null}
UPDATE 2 - Found this article and followed the instructions. Then my app failed to compile. After that I went to the SDK manager based on the marked answers suggest and checked Google Play Services (they were not installed). Now the app builds but still gives the SERVICE_MISSING error above.