2

I am having receiving connection callbacks for GoogleApiClient in ConnectionCallbackListener#onConnected(). As I understand GoogleApiClient.Builder#setHandler() determines the Handler which will receive these callbacks. If not specified it is on the main thread.

However, I am specifically using a GcmTaskService which abstracts the threading for me. This service creates the GoogleApiClient whereby I should set the handler. However, I do not know how to get the handler from this service. Any ideas?

Within my custom GcmTaskService#onRunTask():

    GoogleApiClient.Builder builder = new GoogleApiClient.Builder(mContext)
            .addApi(Fitness.RECORDING_API)
            .addApi(Fitness.HISTORY_API)
            .addApi(Fitness.SENSORS_API)
            .addApi(Fitness.CONFIG_API)
            .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ_WRITE))
            .setHandler(handler)
            .addConnectionCallbacks(this);
Marvin
  • 777
  • 8
  • 17
  • Have you tried reading this? http://stackoverflow.com/questions/23751905/error-implementing-googleapiclient-builder-for-android-development – Android Enthusiast Apr 20 '16 at 10:44

0 Answers0