samedi 2 avril 2016

Google Fit heart rate monitor code : onDataPoint not called

I',m trying to read heart rate from MIO FUSE device. when connected via the app, the Mio Go App does not sync data with Google fit. I tried directly pairing the device via bluetooth menu and enabled 'Body Sensor' from google fit app.

Code:

Fitness.SensorsApi.findDataSources(mGoogleApiClient, dataSourceRequest)
                .setResultCallback(dataSourcesResultCallback);

returns a data source with name of the device and type "DataType.TYPE_HEART_RATE_BPM" datasource. I use that data source to register a listener to get the data. I used the following code for that.

Code:

SensorRequest request = new SensorRequest.Builder()
            .setDataSource( dataSource )
            .setDataType( dataType )
            .setSamplingRate( 10, TimeUnit.SECONDS )
            .build();

Fitness.SensorsApi.add(mGoogleApiClient, request, this)
            .setResultCallback(new ResultCallback<Status>() {
                @Override
                public void onResult(Status status) {
                    if (status.isSuccess()) {
                        Log.e(TAG, "SensorApi successfully added");
                    } else {
                        Log.e(TAG, "adding status: " + status.getStatusMessage());
                    }
                }
            });

This method successfully executes and I get the success result too. But I did not get any callback to

Code:

@Override
public void onDataPoint(DataPoint dataPoint) {
    //do stuff
}

Is there anything more I have do before getting the values.

Phone : MOTO X Running on Android M Bluetooth device : Mio Fuse

1) is there an issue on the way I try to get the values?

2) is there any other way (an app) where I can register the device which will push periodical heart rate results to google fit. I tried this app Heart Rate OS2 app but it did not even asked me to pair my device with it. Endomonodo and Sport gear tracker reported the heart rate along with activity but not directly.


from xda-developers http://ift.tt/1UKE5v9
via IFTTT

Aucun commentaire:

Enregistrer un commentaire