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

monitorSampleType when app is not running #92

Open
faldunate opened this issue Sep 7, 2017 · 0 comments
Open

monitorSampleType when app is not running #92

faldunate opened this issue Sep 7, 2017 · 0 comments

Comments

@faldunate
Copy link

faldunate commented Sep 7, 2017

Hello guys,

I'm using healthkit to obtain some fit data like steps, distance, and calories, I can obtain that information without a problem.

The problem starts when I try to bring that information to my endpoint, monitorSampleType seems to work it when the app is foreground, but when the app is not running, this doesn't work. I understand that HKObserverQuery activates my application when the information is updated in healthkit, but this is not happening.

I activated background fetch of capabilities and I edited my schema to check the option of "launch due to a background fetch event".

this is my code:

this.health.monitorSampleType({
    'startDate': startDate,
    'endDate': endDate,
    'sampleType': 'HKQuantityTypeIdentifierStepCount',
    'unit': 'count'
}).then((data) => {
    this.sendActivity(data).subscribe(response => {
        console.log(response);
    });
});

xcode logs:
Ionic Native: deviceready event fired after 2037 ms Setting up ObserverQuery Background devliery enabled HKQuantityTypeIdentifierStepCount Executing ObserverQuery HealthKit plugin received a monitorSampleType, passing it to JS.

Am I doing something wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant