Apple have added new features in Homekit framework in iOS 9.
I have seen What's New in HomeKit.
In that they have added support of Homekit Accessory Protocol (HAP) over cloud. But they didn't tell how it will work, what developers need to do to support accessories to accessible from apple's cloud services.
I have reviewed their HAP for IP Accessories R3 document, but that document also didn't have any information on this.
What I am looking for is, there should be something at Accessory (Light, Thermostate or bridge) which is added to home in Homekit enabled application and which is accessible for user logged in with icloud account.
Now, to support HAP over cloud at accessory side developer needs to do something so that it can identify for user for which its configured.
So what are the changes require at bridge(gateway or hub) or accessory to implement HAP protocol over cloud?
I have been working on HAP Over iCloud concept since last 2 to 3 hours. The beauty in this concept is according to the documentation we should need the following things.
Apple tv 3rd generation
Have to use same iCloud account in both apple tv and iOS device.
This is most important that Apple tv and Accessory should be on same network.
Eventhough you are on different network it is able to pass the switch on/off,brightness increase/decrease ... actions. For this you can use siri commands or programmatically call the accessory write value functionality
Note : As I know I think when you are passing the commands to the Accessory it checks for the iCloud account in the apple tv and from there it is passing the commands to the Accessory. The apple tv and the accessory both are in same network so apple tv will reach that accessory. Thus apple tv acts as a mediator between the iOS device and Accessory
Related
I am looking for a way to enable personal Hotspot programatically in iOS using Swift or Objective-C but did not see any API or way to achieve that.
My question is that even possible to do that?
Does Apple allow that?
Also as per Apple Developer Documentation HotSpot Helper what are the controls we can achieve that ??
Hotspot Communication
Hotspot helpers can use these APIs to communicate with the hotspot even when Wi-Fi is not the default route.
func bind(to: NEHotspotHelperCommand)
Binds a URL request to the network interface associated with the hotspot helper command instance.
In-Provider Networking
Network APIs for use by all types of NetworkExtension providers and by hotspot helpers.
This is not possible. From Apple's Forums:
There’s no way to do this programmatically. You can get the iOS device’s current Wi-Fi network SSID using
CNCopyCurrentNetworkInfo
, but there’s no way to get the corresponding credentials.
If iOS did allow this, this would be a privacy and security risk. There is no private API to do this either. As Pushkraj Lanjekar said,
You can just open device Settings view from app.
There is no way to programatically control personal hotspot on an iOS device.
This Apple Forums link may be helpful, however; https://developer.apple.com/forums/thread/113933.
Apple don't provide any API to Turn On/Off Personal Hotspot. Rather, you can't change any user setting via code. You can just open device Settings view from app.
Apple's privacy policies will not allow you to do this.
I'm trying to write a super-simple iOS app, just for personal use (i.e. it doesn't need to conform to any App Store stuff). I want it to do the following. Assume it's installed on two devices, both of which I own/control.
On device 1, it has a button that, when pressed, will immediately cause a notification to pop up on device 2.
I'm fine with hardcoding specific apple IDs, device IDs, whatever; it's also fine if this only works when the two devices are on the same LAN/Wifi. all I want is for the above to work, in the easiest way possible, and preferably without needing anything to run on a server anywhere.
How simply can this be implemented? I've set up a whole push-notification system once before, but that required some server-side stuff. Hoping to be able to do this without any of that.
====
Update: realized I wasn't clear in the original post that I need the notification on Device 2 to pop up whether or not the app is currently open/running on that device.
I think that what you are searching for is multipeer connectivity framework.
The Multipeer Connectivity framework supports the discovery of
services provided by nearby devices and supports communicating with
those services through message-based data, streaming data, and
resources (such as files). In iOS, the framework uses infrastructure
Wi-Fi networks, peer-to-peer Wi-Fi, and Bluetooth personal area
networks for the underlying transport. In macOS and tvOS, it uses
infrastructure Wi-Fi, peer-to-peer Wi-Fi, and Ethernet.
source: https://developer.apple.com/documentation/multipeerconnectivity.
You can also check those tutorials:
https://www.ralfebert.com/ios-app-development/multipeer-connectivity/
https://www.hackingwithswift.com/example-code/networking/how-to-create-a-peer-to-peer-network-using-the-multipeer-connectivity-framework
Send sms to port is a way (the protocol will become SMS): https://developer.apple.com/documentation/foundation/nsportmessage
and Maybe Firebase Remote Config can help you: you can get your data in FCM remote config (key-value) from the app :
https://www.raywenderlich.com/17323848-firebase-remote-config-tutorial-for-ios
https://firebase.google.com/docs/remote-config/get-started?platform=ios
, and you can modify your data whenever you want, and the app can fetch it.
I have similar requirements, and it seems like APNS (Apple Push Notification Service) is required for this because it's one of the only ways to 'activate' an application that is in the background.
As a result, then the question is how to make APNS as painless as possible? It seems like combining Firebase Cloud Messaging (or FCM) (to manage APNS / sending messages), and Firebase Functions (to help manage FCM server-side requirements) is one decent option.
From Android documentation:
Caution: When a user pairs their device with another device using BLE, the data that's communicated between the two devices is accessible to all apps on the user's device.
For this reason, if your app captures sensitive data, you should implement app-layer security to protect the privacy of that data.
Is this also true for iOS? I haven't found anything on it and I assumed because iOS doesn't show the true MAC addresses of devices this wouldn't be an issue, but just wanted to check. Thanks
Yes, iOS also works in a similar way. And if you want private communication, you also need to maintain app layer security. Thus android wear, galaxy watch, and other similar devices use encrypted communication in the app layer.
If you already know the details. BLE communication works via Gatt Characteristics.
Consider there are two health applications running on an iOS device and the user also using an activity tracker device. In that case if the user wants to connect both of the health apps with that tracker, he certainly can do it. Both apps will be able to communicate with the activity tracker and get sensor data using the CBCentral module. Look at the diagram for Details.
On the other hand, In general, vice versa will not possible. Because if both iOS apps use Peripheral Role they will register two different instances of BLE-Service even if using the same UUID. Thus it will force two apps to communicate with completely different characteristics instances. However, it is also possible to work with two peripheral apps with the same UUID but this is not what the BLE developers ever wanted.
you need to provide app level security based on Service UUID, so that devices having the app with only same service UUID can connect.
How to communicate with MFI Accessory communicate via USB?
Here's what I've got.
My MFI accessory, other company's MFI accessory and protocol names
EADemo(An Apple official Accessory Demo)
Here's what I've done.
add protocol name toSupported external accessory protocols in EADemo-Info.plist of the EADemo.
Run EADemo with other accessory, send data, text of receivedBytesLabel keep changing.
When I run EADemo with my accessory, click send data, nothing changes in UI.
My colleague(a hardware developer) says I should set interface(like changing a communicate tunnel) after connecting to accessory, so that I can communicate with accessory. But I look up EASession and ExternalAccessory document, I can't find some method that would allow me to change interface. I don't know if it's my problem not setting interface, or it's a problem of the accessory?
How can my App communicate with a MFI accessory?
As nobody has experienced this situation. I'll explain how to communicate with MFI accessory in normal way and what leads to my situation
Usually If you wanna use MFI device, you just need to do the following steps:
Add protocols supported by MFI to Info.plist Supported external accessory protocols.
Connect your MFI accessory to iOS device.
That's it. You can see data change status on screen.
Note: Those procedure are base on Apple official project EADemo, you can download from the official site.
Here's what I've been experienced:
The MFI accessory support 2 protocols, one is for connection event, the other one is data exchange(like my colleague said before, there should be 2 interface). But the manufacture didn't give the specific document. So when I connect one protocol, of course there's no data exchanging. So I connect the first protocol, and step back, connect to the second one. It works, there's data exchange status on screen.
I am new to HomeKit , and I got a demo board which it can work with iPhone.
When I turn on the demo borad , I can see the Accessories in Setting -> WiFi. I click the Accessories and add the Accessories to the WiFi Network. The Accessories and the iPhone are in the same WiFi Network.
I turn on Siri and say "Turn On the Light" , the LED on the demo board will turn on.
But it should has other command to control the light for adjust light levels up or down.
How do I know the all command of Siri about HomeKit in iOS ?
Thanks in advance.
Homekit has its central database for managing homes and its features.
Database is shared with all homekit enabled apps install in iOS device.
And also by siri.
So siri will have access to names you have given to Home, accessory, trigger, scene etc.
Now you can use the names you have given and default characteristic of any accessory to execute by siri.
like "Siri, turn on the desk lamp in the Main hall"
For the above command on is a value of the characteristic.
desk lamp is an accessory.
Main hall is name of room.
In this command home name is not provided so siri will consider it for primary home.
You can create commands by your own.
Below are few the examples.
"Siri, set library temperature in My Home to 72"
Here library is name of Room
My Home is name of Home
temperature is characteristic which is apple definded siri keyword.
72 is Value of characteristic.
You can refer to apple documentation for more detail.
https://developer.apple.com/library/ios/documentation/HomeKit/Reference/HomeKit_Framework/