Apple HealthKit Determine Between Watch and iPhone - ios

Currently we are programming an application in Xamarin. The application pulls activity data from the apple health kit. We haven't found a class that can distinguish between the apple watch and the iphone data, when we pull from the Apple Healthkit. For example, when someone walks with their phone and watch it is logging steps for both devices. So we are having trouble getting an accurate count.
I know Swift has predicateForObjects & HKSourceQuery. However, is there a version of these classes for xamarin?

Related

Can I develop apple watch app that uses heartbeat, accelerometer etc without owing apple watch? only using simulator?

I want to build an watchOS app which uses heartbeat data and I don't have apple watch yet.
Is it possible using simulator(watchOS simulator)?
It is possible to use HKWorkoutSession also there is a nice tutorial creating a prototype would be useful for you.

Have anyone worked on migrating an iOS app with Watch OS1 to Watch OS2 or higher versions which share data between iPhone & Watch

Have anyone worked on migrating an iOS app with Watch OS1 to Watch OS2 or higher versions. I have used Coredata & Appgroups for sharing data between iPhone app and watch app. Now in the newer Watch OS 2(& above) Apple no longer supports Appgroups to share data across iPhone app & Apple Watch app. Could you please help me in this.
I need to use Coredata to share data between the targets without having Appgroups.
Implement two-way communication between your Apple Watch app and the paired iPhone app with the Watch Connectivity framework.
Apple provided the sample code here
for connectivity between apple watch app and iphone app using latest OS version.
Apple OverView
Most Apple Watch apps require an exchange of data with a paired iPhone app. This sample demonstrates how to use the Watch Connectivity APIs to:
Update application contexts
Send messages
Transfer user info and manage the outstanding transfers
Transfer files, view transfer progress, and manage the outstanding
transfers
Update current complications from iOS apps
Handle Watch Connectivity background tasks
On watchOS 1, the watch app was an app extension that actually ran on the paired phone and the watch simply acted as a remote display. This is why it was possible to share data using an app group, just as you can with any other extension.
From watchOS 2.0 onwards the watch app executes on the watch itself so the watch app and the companion app no longer share a file system.
In fact, where possible, users should be able to use the watch app even when the watch isn't near the paired phone. This means that you need to adopt an asynchronous data sharing approach between the watch and phone apps
You will need to use the Watch Connectivity Framework for your app.

Get all wearable data from healthkit

I want to get step count from wearable devices such as samsung gear fit bit etc from the healthkit api.
I want to know if it is possible to get data of all the wearables from the healthkit itself.
According to Apple, HealthKit provides a central repository for health and fitness data on iPhone and Apple Watch.
Health Kit works only for iOS and WatchOS devices.
If you need to integrate Fitbit data into your iOS App, you need to use their api.
According to Samsung developer page, Companion applications are not supported for iPhone.

How to get a Nativescript app on Apple Watch and use Health Data?

I'm trying to set up a basic nativescript app on Apple Watch 3 which reads Heart Rate data. I realize that I would need WatchKit, but how do I set up the app, Sidekick only gives the option of iPhone or iPad.
Also, what's the Nativescript way of writing companion code for the iPhone which will receive this data from the phone?
Apple Watch Integration will be available in next {NS} release.
https://www.nativescript.org/roadmap-and-releases#releases

Some questions about Apple Watch

I'm started to working with Apple Watch today.
I'm searched on internet about Apple Watch & watchOS 2, but have some stuck while understand all of them (please for give me for bad English, thanks):
1. Can Apple Watch detect shake motion of user when they're shaking their hand? (I mean like shake to change song when play music, shake to change picture?). In iOS I'm using the function motionBegan, motionEnd to detect it. But don't know how to detect this event on apple watch, seem like Apple doesn't mention it on their document. Can you show me how to detect shake event of user?
2. In example, I have an application running on iOS version. How can I create one more version for Apple Watch that can communicate with my iPhone app?
3. Apple say from watchOS 2, the app can run natively without the iphone. But when I'm created a demo app, I'm still need iphone to build & run. Is there anyway to build & run my app in my watch without the phone?
4. I was created an demo app on watchOS 2, which have an button. Now I want whenever I'm pressed on this button the Siri will appear to recognize my voice. Is Apple let me to access Siri from my own app? If yes, how can I do it in my code?
1. You can access a subset of the CoreMotion API on the AppleWatch. But the use of this API is limited to when the AppleWatch app is active. So if the user has your app active on their wrist they could shake and you could get CoreMotion data to detect what you need. Check out the available APIs on CoreMotion here.
2. Don't really understand the question try to clarify a bit. If you are looking for how to send messages between the iOS and watchOS app check out my post here Send messages between iOS and WatchOS with WatchConnectivity in watchOS2
3. Yes AppleWatch apps in WatchOS2 runs natively. But you still need an iOS app to get the AppleWatch app installed. Apple watch is mainly developed to act as a companion to your phone. So when you install an iOS app you get the choice to install the (if it exists) companion AppleWatch app.
4. Oficially, no. You canĀ“t access the Siri API for now.

Resources