Can I build HomeKit, HealthKit iOS 8 apps with VS 14 and Xamarin? Thx, Ivan
Also looking for details on this - especially HomeKit.
There don't appear to be any details regarding Xamarin and HomeKit anywhere..
The iOS 8 blog entry mentions HomeKit and a sample project, but one isn't present on the current samples page.
I realize that Xamarin has bindings for 100% of the iOS 8 API-
However, is the HomeKit Accessory Simulator available to us?
For those interested in HomeKit, I have a small example project in Xamarin.iOS that I'll attach to this post. I've not used it in a while so it might not be 100% functional right now but it should be enough to get you off the ground. You'll have to make some modifications to how the project is signed and built, because access to HomeKit depends on the bundle signing and entitlements.
Before a Xamarin application can utilize the HomeKit Framework, the application must be correctly provisioned, in both the Apple Developer Portal and in Xamarin Studio.
Do the following to enable HomeKit support:
To make testing of a HomeKit enable mobile applications possible, Apple has created a HomeKit Accessory Simulator that allows the developer to create and configure different types of simulated home automation accessories. Using the simulator, the developer can create a wide range of virtual hardware with different configurations of options and features. Apple is providing the HomeKit Accessory Simulator as a separate download from Xcode 6.
To install the simulator, do the following:
To start the HomeKit Accessory Simulator and create a few virtual accessories, do the following;
With some sample virtual HomeKit accessories created and configured, a Xamarin iOS 8 mobile application can be created to consume and control these accessories.
When the application is first run, the user will be asked if they want to allow it to access their HomeKit information. If the user answers OK, then the application will be able to work with their HomeKit Accessories otherwise it will not and any calls to HomeKit will fail with an error.
A Primary Home must be created and configured before any other function of the HomeKit framework is available to an iOS 8 mobile application. It is also the responsibility of the application to provide a way for the user to create and assign a Primary Home if one does not already exist. After the application first starts or when it has returned to focus after being in the background, it should monitor the DidUpdateHomes event of the HMHomeManager and check for the existence of the Primary Home. If one does not exist, it should provide an interface for the user to create one.
Once a Primary Home has been created or accessed, the iOS 8 application can call the MHAccessoryBrowser to find any new home automation accessories and add them to a home. Once the new accessory has been found, it should be presented to the user and they should be allowed to select an accessory and add it to a home. When the user selects an accessory from the list, the application calls the Home’s AddAccessory method to add it to the Home’s collection of accessories. The user will be asked to enter the setup code for the device to add, In the HomeKit Accessory Simulator this number can be found under the Accessories Name. For a real HomeKit accessory, the setup code will either be presented in the accessory’s user manual, on the product box or on a label on the device itself.
When working with HomeKit Service Characteristics and simulated accessories, modifications to Characteristics values can be monitored inside the HomeKit Accessory Simulator. With the HomeKitIntro app running on real iOS Device Hardware, changes to a characteristic’s value should be seen nearly instantly in the HomeKit Accessory Simulator.
NOTE: Testing HomeKit only works on a real iOS 8 Hardware Device and not in the iOS 8 Simulator.
Again, I hope this is enough information to get you off the ground with HomeKit. Please let me know if you have any questions.
Xamarin Inc., as a wholly-owned Microsoft subsidiary acting as a separate legal entity, adheres to the Microsoft Privacy Statement: Privacy & cookies