Apple watch's gyroscope.available always return false - watchos-2

I'm able to get accelerometer data from Apple watch, but I'm unable to get gyroscope and magnetometer data. gyroscope.available always return false. Has anyone found a way around this?

As of watchOS 2, while the core motion API's exist the gyroscope and magnetometer are not available. There is no way around what you are seeing. Developers currently only have access to the accelerometer.

Related

WatchOS How to keep to get acceleration data

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.

CMSensorRecorder for gyroscope data

iOS lets you specify that accelerometer data should be recorded, and then allows you access to the recordings at a later date:
https://developer.apple.com/documentation/coremotion/cmsensorrecorder
But, is there the equivalent for the gyroscope?
No, but of course you can watch the gyroscope at any time. The reason is that the gyroscope, unlike the core motion sensor, is very battery-heavy and doesn't even run unless some app asks it to.

Is it possible to get the hardware details of a given sensor in iOS like android?

Hello All,
I am creating an iOS application which uses the accelerometer sensor. I am able to get the sensor data using CMMotionManager. I also want to get the sensor's hardware details like Sensor Name, Vendor, Type, Range, etc. I can get these values in Android, but I couldn't find a way to do it even after searching all over the internet. Is this possible to get those values in iOS?
I don't think you can get that information from iOS, mostly because there is only one vendor for iOS devices and that is Apple. On Android you can have many device providers and it makes sense to let you know more about that device tech specs, but not on iOS.

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.

Sync to an iPhone's Location Data?

I'm attempting to create a simple single-page website that answers the following yes or no question: is a specific iPhone on land?
To explain further, I want to track the iPhone of my brother who works on a tugboat to find out if he's on the boat or on land. Is there a way of syncing to his iPhone's GPS data? Perhaps through "Find my iPhone" or a similar app?
Thanks for your help.
On iOS you can access the GPS coordinate of a device using CoreLocation, specifically CLLocationManager. You can poll it for updates and you get back a CLLocation object that has your latitude/longitude. There may be another step you need to perform after this to see if a GPS point is on land or not, which I'm not exactly sure the best way to approach.

Resources