iOs CoreBluetooth Central Server and Peripheral Client - ios

Currently, iOS does not support the combination GAP Central role and ATT Server role as well as the combination GAP Peripheral role and ATT Client role.
Is Apple working on this? Does someone know when it will be possible to do so ?

If you develop a non iOS peripheral, then you should be able to start acting as ATT client once the iOS central connected to you. The ATT database is shared accross applications and should be accessible this way. You can initialize it in a separate app or in the same app using a CPBeripheralManager.
Otherwise, there has been no indication from Apple that they would be considering this use case so I wouldn't expect it be implemented in the foreseeable future.

Related

If my iOS app pairs with a device using Core Bluetooth, will other apps have access to the device?

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.

Custom BLE Advertisement on iOS

I'm hoping to create a BLE advertisement on iOS where I can control the advertisement on a byte level.
One use case would be to mimic an iBeacon advertisement. What is the iBeacon Bluetooth Profile (I want to advertise while my app is in the background which is why I'm not using CoreLocation)
I do not see a way to do this with the Core Bluetooth API. Is this correct? Are there alternatives using private API's or jailbreaking?
As the others already pointed out, there is no API on iOS that allows you to do this.
You can advertise as an iBeacon, but only when your app is in the foreground. When in background, the advertisement is removed and therefore cannot be discovered anymore (except for other iOS devices which explicitly scan for that service UUID). Also see the documentation here: Core Bluetooth Background Processing
If you would share your use case and what you want to achieve, maybe there are other ways to realise it.
My experience with iOS is that if it is something is not exposed in the API, there is no way around, except jailbreaking. For Bluetooth low energy the API is at GAP/GATT level, and very little at the lower levels (if anything) is exposed. Advertising is a LL (link layer) feature.
To illustrate how restricted the access is: When scanning for BLE devices you will not have access to the advertiser's MAC address iOS. In Android you have it.
I do not see a way to do this with the Core Bluetooth API. Is this
correct?
Since you have to set Manufacture Specific Data in order to achieve this, if nothing has changed you will experience exactly the same issue that I did. Explained here:
The advertisement key 'Manufacturer Data' is not allowed in CoreBluetooth
It is not possible.

how to send data from airwatch to ios app

I'm a junior ios developper trying to communicate with the MDM server : air watch.
I found lot of topics talking about getting the data from the MDM server in my app (like Using MDM To Configure An Enterprise App Via NSUserDefaults and https://www.devexpress.com/Support/Center/Question/Details/T224565) but I cannot find any tutorials on how air watch send data to ios app.
Does anybody face the same problem or have links to help me get through ?
Thanks in advance !
This will work: AppConfig
Implementation in iOS is much simpler than Android
I am not sure what data you want to send down to the app, but syncing application data is usually not the domain of an MDM/EMM solution. I would use either use Apple APNS to publish to the app (directly or through a 3rd party provider) or use periodic polling initiated from your app to fetch you data. A common pattern is to publish a small payload to the app (e.g key-oriented data) and then let it fetch the real application payload using the Apple networking stack
If you use APNS and your enterprise is averse to opening your network to the internet (very common), consider a 3rd party provider like UrbanAirship, Azure,... They handle the initial token handshake as well as provide nice group messaging and other features. Good luck.

WiFi Authentication Without MAC Address (iOS)

I’m currently working on a small project with the goal of using an iOS App to provide a secure, centralized login for a network of WiFi hotspots in small and medium sized businesses. The plan was to configure the routers as open networks and DHCP forward all the traffic from the router to our (cloud-hosted) server, where each query is authenticated and the user’s query is allowed to pass to its intended destination.
Our current problem is that in order to configure the server to know which users are accessing it we need the Mac Addresses of the users, which the Apple API requires they type in manually the first time they use the app (which is a lot of work) so we are trying to come up with a work around.
Any thoughts or suggestions would be hugely appreciated.
Thanks,
Alex
:)
Since iOS 7 you can no longer get the MAC Address. Based on what you are trying to do, I would recommend using one of the device identifiers available through iOS like identifierForVendor which will give you an unique id.
as per Apple Docs:
In iOS 7 and later, if you ask for the MAC address of an iOS device,
the system returns the value 02:00:00:00:00:00. If you need to
identify the device, use the identifierForVendor property of UIDevice
instead. (Apps that need an identifier for their own advertising
purposes should consider using the advertisingIdentifier property of
ASIdentifierManager instead.)

How to broadcast bluetooth service in ios using corebluetooth?

If I want to have my iOS device act as a "server" and broadcast its bluetooth services to other iOS devices, how would I use the core-bluetooth framework (or any other iOS framework) to implement this? So far, all I've seen from the corebluetooth framework is how to write the client-side of things. (Scanning, connecting to existing bluetooth services)
You can make use of the OSX sample project called DNSSDObjects. The core classes (three of them) work just fine under iOS. The code requires a few small changes to work with Bluetooth (as-is they only work with WiFi). See my answer to another question for the required code changes.
Basically you use whatever code you need to setup your server and begin accepting socket connections. You then use the DNSSDRegistration class to advertise your server via Bonjour.
The other two classes, DNSSDBrowser and DNSSDService can be used by iOS client code to find the server, or any app or program that can find Bonjour services will also be able to find your server.
There are two great WWDC video that show how to act as either the client or the server using an appropriate iOS device. They can be found here, you're looking for sessions 703 and 705.
Downloads of the source that they use can be found here. You'll need a developer account (free works) to login and view/download.

Resources