-
Notifications
You must be signed in to change notification settings - Fork 130
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
asynchronous register to data type #94
Comments
Thinking about helping out with this, we were interested in finding a way to synchronise health data to our servers from the background. I'll start by looking at IOS. |
Background in Cordova is quite challenging. There are ways, but they are not perfect. You can always write a plugin that implements the specific logic you need, but it'll be native, not JS. Anyway, please share your findings ! |
It looked like it should be possible with HKObserverQuery and enablebackgrounddelivery unfortunately I do not understand objective-c enough or the cordova structure to progress this. I think queries would need to be setup in pluginInitialize but how to keep it a generic plugin at that stage. So I'm not going to look into this any further for the moment. EddyVerbruggen#92 details the current limitation. I was using the following code to test it out in your health.js.
|
even if you manage to make the HKObserverQuery work, you will probably have to bring the app to foreground anyway so that the webview could run the JS code. One way could be creating a plugin that executes a generic JS engine in background. Both Android and iOS have JS engines (like this or this) but that's the goal for a completely separate plugin (a very needed one indeed !). |
whenever a new sample of a certain data type is available, wakes up the app.
For HK: see Telerik's monitorSampleType (which relies on this).
For GF, it could be done through registerDataUpdateListener of HistoryApi
The text was updated successfully, but these errors were encountered: