Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Google Play Services Sleep API? #261

Open
lacksfish opened this issue Jun 29, 2022 · 3 comments
Open

Add Google Play Services Sleep API? #261

lacksfish opened this issue Jun 29, 2022 · 3 comments
Labels
enhancement feature request

Comments

@lacksfish
Copy link

lacksfish commented Jun 29, 2022

I am wondering how this project relates to the Google Sleep API for Android SDK >=29. I plan to create a simple App which periodically checks the current sleep state of the user and am contemplating if developing it in Kotlin via the Google Sleep API or via Cordova/Ionic and the cordova-plugin-health.

Would you have any input on this? I'd prefer to go the Cordova/Ionic route, as I am more familiar with JavaScript. Also I see an added benefit in providing the functionality of my app to iOS users as well within one codebase. 😇

From what I've gathered, this plugin allows me to read the current "sleeping state" via the respective "Health" APIs for Android and iOS. Do you have any tips if this plugin is what I am looking for with regards to reading this data ? I've consulted the Readme and found the Warning section mentioning that functionality is undergoing changes which may not have been implemented in the codebase as of now. If you could provide any clarification it would be much appreciated ! 🙏

Sorry to bother you with this "issue", but I'd really appreciate your input during my research regarding the tech-stack of my fringe app idea :)

All the best!

@dariosalvi78
Copy link
Owner

dariosalvi78 commented Jun 29, 2022

I guess that the underlying data is the same, but the Fitness API is richer. Now the gotchas:

  1. this plugin does not support asynchrnous data updates (like events being sent when something changes), only queries in the past.
  2. the Google Fit APIs have introduced a new way for managing sleep (with a separate data type) and we are still using the old one (with the generic "activity" data type). My experience so far is that some apps still write the sleep data using the old API and other don't, but this is going to change at some point. I would be very glad if someone wanted to help on updating the plugin with the new API, the task is not particularly difficult and I can offer guidance.
  3. accessing the Fit API is a pain in the **s, you need to comply with lots of rather arbirtray rules and go through a lengthy review with Google. You need to choose on what you want to lose you mental sanity: on coding (use the other API) or on bureaucracy (use the Fit API).

@dariosalvi78
Copy link
Owner

actually, after reading the documentation about this sleep API I am not sure that the underlying data is the same. The Fitness API uses external sources such as other apps or wearables, this new API uses the internal sensors.

Maybe we can add it to this plugin as well?

@maverickdude
Copy link

maverickdude commented Nov 2, 2022

I am also unable to get the sleep data from Google Fit in the same way as Apple Health. Hoping that this issue would resolve soon 🙏

@dariosalvi78 dariosalvi78 changed the title Sleep data via this plugin? Comparison to Google Sleep API Add Google Play Services Sleep API? Dec 22, 2022
@dariosalvi78 dariosalvi78 added the enhancement feature request label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request
Projects
None yet
Development

No branches or pull requests

3 participants