So I'm trying to work with Google Fit and for some reason I can't connect to Google Play Services in my app. I have the OAuth all set up completely and I tested it in another app and it all worked just fine. Specifically look at the GoogleFitRepository, this is where I'm connecting to the API.
I'm getting this error when trying to connect:
W/AutoManageHelper: Unresolved error while connecting client. Stopping auto-manage.
I/MyApp: Google Play services connection failed. Cause: ConnectionResult{statusCode=CANCELED, resolution=null, message=null}
Link to GitHub: https://github.com/drb56/FitnessExplorer
Any help would be greatly appreciated. I've been stuck on this all day!
Edit: here's some code from the class in question
public GoogleFitRepository(Activity activity)
{
mClient = new GoogleApiClient.Builder(activity.getApplicationContext())
.addApi(Fitness.HISTORY_API)
.addApi(Fitness.SESSIONS_API)
.addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ))
.addConnectionCallbacks(this)
.enableAutoManage((FragmentActivity)activity, 0, new GoogleApiClient.OnConnectionFailedListener() {
@Override
public void onConnectionFailed(ConnectionResult result) {
Log.i("MyApp", "Google Play services connection failed. Cause: " +
result.toString());
}})
.build();
activityList = new ArrayList<>();
activityDataPointList = new ArrayList<>();
calorieActivitiesToday = new ArrayList<>();
dayActivities = new ArrayList<>();
}