Why is my Fitness.SensorApi OnDataPointListener only called once?


My GoogleApiClient connects successfully and my @Override public void onDataPoint(DataPoint dataPoint) {…} is called exactly once and then never again. This is within a Service that's started only after Google Fit is authorized from within the UI (that's another can of worms). The Service has another GoogleApiClient that successfully runs and is called at my specified interval.

Here's what I see from logcat:

mGoogleFitApiClient connected.
mGoogleFitApiClient listener registered.
mGoogleFitApiClient detected DataPoint: still (100.0% confidence)

It's then never called again and @Override public void onConnectionSuspended(int i) {…} is never called either.

Here's the relevant code from my Service:

private void buildFitnessClient() {
    mGoogleFitApiClient = new GoogleApiClient.Builder(this)
            .addScope(new Scope(Scopes.FITNESS_ACTIVITY_READ))
                    new GoogleApiClient.ConnectionCallbacks() {
                        public void onConnected(Bundle bundle) {
                            Log.i(TAG, "mGoogleFitApiClient connected.");

                        public void onConnectionSuspended(int i) {
                            if (i == GoogleApiClient.ConnectionCallbacks.CAUSE_NETWORK_LOST) {
                                Log.i(TAG, "mGoogleFitApiClient connection lost. Cause: network lost.");
                            } else if (i == GoogleApiClient.ConnectionCallbacks.CAUSE_SERVICE_DISCONNECTED) {
                                Log.i(TAG, "mGoogleFitApiClient connection lost. Reason: service disconnected");
                    new GoogleApiClient.OnConnectionFailedListener() {
                        public void onConnectionFailed(ConnectionResult result) {
                            Log.i(TAG, "mGoogleFitApiClient connection failed. Cause: " + result.toString());

public void onDataPoint(DataPoint dataPoint) {
    String activityName = "";
    float confidence = 0;
    for (Field field : dataPoint.getDataType().getFields()) {
        if (field.getName().equals("activity")) {
            activityName =  dataPoint.getValue(field).asActivity();
        } else if (field.getName().equals("confidence")) {
            confidence = dataPoint.getValue(field).asFloat();
    lastActivityName = activityName;
    lastActivityConfidence = confidence;
    Log.i(TAG, "mGoogleFitApiClient detected DataPoint: " + activityName + " (" + confidence + "% confidence)");

private void setupPhysicalActivityListener() {
    SensorRequest sensorRequest = new SensorRequest.Builder()
            .setSamplingRate(15, TimeUnit.SECONDS)
            .setFastestRate(5, TimeUnit.SECONDS)
    Fitness.SensorsApi.add(mGoogleFitApiClient, sensorRequest, this)
            .setResultCallback(new ResultCallback<Status>() {
                public void onResult(Status status) {
                    if (status.isSuccess()) {
                        Log.i(TAG, "mGoogleFitApiClient listener registered.");
                    } else {
                        Log.i(TAG, "mGoogleFitApiClient listener not registered.");

The request data type is




to see if you get the same result.(only called once)