Comments (8)
According to the Apple Documentation related to background updates, the observing queries should be initilized in didFinishLaunchingWithOptions of AppDelegate file. This background delivery and observing queries combination will allow you to get notifications from Apple Health even if your app is killed. The idea is that whenever a new value appears/disappears in Apple Health, the observerQuery's update handler will be triggered, and the code you provide there will be executed. But, unfortunately this works only natively.
I am afraid there is no chance for now to do the same in Flutter part of the library, i.e put observation in "main" function.
Because events handling between the native part and the flutter part starts when the subscription is set on the flutter side.
Although the observer query will be still running when the app has "Not Running" lifecycle state, the stream subscription on the flutter side will be canceled when the app will be killed by the system.
I will try to adjust the explanation in README
from health_kit_reporter.
Btw, in order to see how ObserverQuery is actually working, you can check out a native example of the HealthKitReporter. It is the base library for this flutter wrapper
from health_kit_reporter.
I will also present some changes in event handling in new version
from health_kit_reporter.
@VictorKachalov thx for the quick response.
This library seems to be able to do it https://github.com/nanoglobal/nano_healthkit.
Also https://github.com/fluttercommunity/flutter_workmanager should be doing something similar.
from health_kit_reporter.
Ok, it appeared, that it was suppose to work all the time :) but was a lack of an appropriate Capability for background fetch and an argument exceptions in enabling background deliveries. You may try again. In the example app I added some local notifications, which should be triggered if some data changes. The version is 1.0.5 now.
from health_kit_reporter.
Have you already tried to use this package with observing queries on and while the app is in background/killed?
from health_kit_reporter.
from health_kit_reporter.
@VictorKachalov I've been testing ObserverQuery while the app is killed but I can't make it work properly. I already enable background capabilities and even init the observer as an isolated function in the main method of the app. I can say it was working a few times while the app is killed but after waiting some time it stops working properly. Thanks in advance
from health_kit_reporter.
Related Issues (20)
- HealthKitReporter.workoutRouteQuery: Unhandled Exception: type 'Null' is not a subtype of type 'List<dynamic>' HOT 6
- Support retrieving voltage measurements for ECG records HOT 1
- Save WorkoutRouteHarmonized HOT 1
- Build error 2.0.3 - extra arguments at positions #2, #3 in call ... reporter.reader.electrocardiogramQuery HOT 2
- Is there a way to pull a list of workouts? HOT 2
- No new data on subsequent queries HOT 4
- Adding Blood Pressure Correlation Crashes HOT 3
- Build error with latest version HOT 1
- HKMetadataKeySyncIdentifier / HKMetadataKeySyncVersion are not updated when passed in Quantity.metadata HOT 3
- Calling `statisticsQuery` for `QuantityType.restingHeartRate` is never returning (future never completes). HOT 2
- Calling `statisticsQuery` for a `QuantityType` that does not have any data in Health Kit should not throw. HOT 1
- Flutter throwing categoryQuery identifier error HOT 1
- support iOS 16 sleep stages HOT 2
- Category.sourceRevision should be nullable
- Deprecated usage warning
- Add a way to verify platform support HOT 1
- Hard Crash when addQuantity is used. HOT 1
- Workout metadata missing. HOT 2
- InvalidValueException with swimBikeRun activities
- method data not found when predicate period include minutes and seconds HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from health_kit_reporter.