androidgoogle-fitgoogle-fit-sdk

Not cheatable Google fit step counter


i have a question to Google Fit. I am creating a step counter (oh wonder g). This i have already done so far and it not really hard. But now we come to my problem. I am only reading the steps with the Sensor API. The issue is, i can add new data via for example the Google Fit app and it will be counted in my app too. This introduces cheating and i do not want this.

So i need to have a way to only read "device created" data and not manually added data. Is there a nice way to to this? From the SDK documentation it is not really clear how to proceed here.


Solution

  • So i need to have a way to only read "device created" data and not manually added data. Is there a nice way to to this?

    You will want to use Private Custom Data Types to achieve that. Read about the different types of Fitness data you can upload to Google Fit here.

    1. Public data types

    Standard data types provided by the platform, like com.google.step_count.delta. Any app can read and write data of these types. For more information, see Public Data Types.

    2. Private custom data types

    Custom data types defined by an specific app. Only the app that defines the data type can read and write data of this type. For more information, see Custom Data Types.

    3. Shareable data types

    Custom data types submitted to the platform by an app developer. Once approved, any app can read data of a shareable type, but only whitelisted apps as specified by the developer can write data of that shareable type. For more information, see Shareable Data Types.