WatchOS How to keep to get acceleration data - ios

I'm writing independent watchOS app. I'd like to keep app turn on & getting acceleration data, but app go sleep & don't get data shortly.
I think it might be hard to keep getting data according to my sources, so I use remote-notification & try to get data as much as possible. Is there anything better way to get more data or keep getting data?

I could solve it by making workout session. it can keep to get acceleration data while workout.

Related

Is it possible to query the Blood Oxygen Saturation sensor from your own app on Apple Watch Series 6?

Good morning,
This may be a bit of a stupid question but I cannot find the answer anywhere!
For a project I am working on a requirement is to regularly check the user's blood oxygen levels. I understand that through HealthKit I can view stored SPO2 results, however I have not been able to find a way to initiate a Blood Oxygen Saturation test from my own application.
Is this even possible? If so, a nudge in the right direction would be greatly appreciated!
Edit for more detail: I've managed to get other health data to query regularly such as Heart Rate by using a workout and WatchKit Connection to send updates to the iOS device regularly. This method does not seem to be suitable for Blood Oxygen as there is no workout that tracks SPO2. Perhaps there is a way to add SPO2 tracking to a workout?
Best regards,
You cannot trigger an SpO2 measurement on the watch through API. You should file a feedback assistant request to Apple with your use case if you need this functionality.

How to get sleep data without healthkit in iOS 10

I wants to get accurate sleep data into my iOS app without using health kit.
Please provide suggestions.
https://apple.news/As1Ja5ZpOSzOt--RV8NkIWQ
No, for getting sleep data from iphone you need to use the health kit. Even if you use any third party frameworks for getting sleep data, internally it has to use health kit thus requires user permission for the same.
Any way asking permission is one time and hence it should not affect the user experience.

CloudKit and Core sync data between devices

I created a simple Notes app based on Core data. Now i want add sync between user devices.
And all articles that i read (this, this) said that i should fully get rid of my core data database, and all my code will lost and rework all with ICloud kit?
The is no way to sync data from Core Data to ICloud ? And if i get rid of core data, how my app will work offline ?
And please suggest good simple projects with ICloud sync
P.S. I googled about an hour. Icloud is deprecated so do sync with it is not recommended. I confused. How now i can sync data between devices??
Core Data used to have iCloud syncing, but it has been deprecated as of iOS 10. It had several problems, sometimes major.
Apple now has something called CloudKit, which is not the same thing. You can use CloudKit to sync data between devices. But this does not mean that you should drop Core Data. CloudKit only syncs; it is not a replacement for having your app save data on the device, it's only a way to send data to other devices. If you're using CloudKit, you also need to use some other way to store data on the local device.
Also, it's "CloudKit". Not "ICloud Kit". I don't know why, but it's important to get the names right.

Watch and accelerometer-what you can really do?

It seems to me that there is some kind of wrong perception of the WatchOS abilities.
After reading all the Apple docs, and exploring, this is what i know :
No gyroscope or magnetometer (compass) API's , which means there are so many things you can't know without them about the user.
The accelerometer, is only working when the app is in the foreground/background for limited time.
If you want to know what happened during the day with the watch , you can check your Health app, and get some picture about the accelerometer.
The thing about 3, is due to limited power consumption, you don't get high sampling rate, as you would get when the app is in foreground , which means again ,you can't know even with the accelerometer whats really happening during the day. catching the small gestures .
Am i wrong about something here assuming the WatchOS 2.1 ?
Can you really learn about a user without these abilities ? for example like what you get in the Jawbone app ?
The "fitness" thing is not really there, developers can't barely do nothing .

Best Way to get Heart Rate in iOS HealthKit App?

I'm writing an iOS app to display real-time Heart Rate from a BTLE device (the Polar H7). I've found 2 ways to do this:
Using CBCentralManager and bit-twiddling the Heart Rate Measurement Characteristic by hand
Using HealthKit's HKObserverQuery
As I see it, there are pros/cons to each approach.
Using CBCentralManager enables more control (e.g., you can store the sensor location) and quicker setup (i.e., you can start displaying values immediately). But, from what I can tell, the BTLE device will not be seen by CBCentralManager if the BTLE device is already paired with HealthKit.
Using HealthKit appears to be the preferred approach (and is much simpler to implement) but requires an extra trip to the Health app to turn on the "Update Health Data" switch.
Should I implement both? Has anyone dealt with this issue?
I haven't dealt with your issue specifically, but I am working on HealthKit integration as well. Based on what you've outline here, I would go with the HealthKit approach and only that approach unless there's some requirement to really push you do to both. If you do have to implement both, I would probably put some abstraction in there so the controllers don't have to know what the source is.
I'm not sure about the extra trip to the Health app you mention. You can ask for permission to the heart rate data from within your app using requestAuthorizationToShareTypes:readTypes:completion:. Here's a tutorial that has a walk through, in case that helps at all: HealthKit Tutorial with Swift: Getting Started.

Resources