I have a watch face which I am trying to connect to the Google Play Services to get the user's heart rate data. I have created an OAuth 2.0 client ID and have followed the guide.
Here is my setup code from OnCreate():
googleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.addConnectionCallbacks(this)
.addOnConnectionFailedListener(this)
.addApi(Fitness.SENSORS_API)
.addScope(new Scope(Scopes.FITNESS_LOCATION_READ))
.build();
googleApiClient.connect();
I am triggering the OnConnectionFailed() listener. here is the ConnectionResult:
ConnectionResult{statusCode=INVALID_ACCOUNT, resolution=null, message=null}
My full class can be found here: http://pastebin.com/qNuvRY3F
I've either missed something or I am doing all this in the wrong place. Probably both. I may need to get this data from my mobile device and send this data over via the DataLayer, which I am still trying to figure out how to do in a background service, which to send alongside battery info, weather data etc.
Any insight is appreciated. Thanks
The error INVALID_ACCOUNT
means that the client attempt to connect service using invalid account name specified.
Error code are used by the GoogleApiClient.OnConnectionFailedListener helper class. Error are generated by the Google Play Service server when something does not work. Working with Google Play will be an important area for Wear
developers to master.
Here's a related SO ticket: Issue with Google Fit API on Android Wear