Handle iPhone calling from external device (e.g. a car) - ios

How does a car's system handle calls from an iPhone? The device is plugged through into the car's system using the dock connector at the bottom of the iPhone. Now when a call comes through the car intercepts it and you can press a button (usually on the steering wheel) to answer and then speak through the inbuilt microphones of the car and listen through the speakers in the car. All of this is done through connecting the device into a dock.... how does this work?
P.S: Is it possible to initiate calls from an outside system as well?
P.P.S: All of this is done without an App being installed on the iPhone itself though...

Any bluetooth devices that implement HFP or HSP bluetooth profiles will be able to receive the call from iPhone.To display the info( Caller ID or Contact name) on the car kit, the device has to implement PBAP or MAP bluetooth profiles.No App is required on iPhone.

Related

Detect when iPhone is connected to car bluetooth

I'm trying to detect when I am connecting/connected to a car via bluetooth. I am currently using AVAudioSession and the properties currentRoute and outputs to determine what types of routes are connected. However, the port type 'carAudio' only correlates to when the phone connects to the car via Aux or some sort of Cable, but when connecting via bluetooth with a car's audio system the output route is always A2DP.
I understand that most cars now implement bluetoothA2DP, but I was wondering if there was some way for me to detect whether or not the bluetooth type connection is from a car, as opposed to some bluetooth headphone/speakers. (Also for both input and output, I never seen to detect BluetoothHFP)
I believe this is possible as apps like Spotify supports this functionality, and works perfectly when I connect my spotify app to the bluetooth, however my code cannot detect this connection.

iOS Detect Bluetooth connection/disconnection

Is it possible to be notified when a Bluetooth Device is connected or disconnected from iOS even when my app is in background ?
On Android, I use the ACTION_ACL_CONNECTED and ACTION_ACL_DISCONNECTED events. But I cannot find equivalents for iOS.
I found the CBCentralManager that can be used to monitor Bluetooth events, but my functions aren't called when a bluetooth device is connected/disconnected, only when I enable/disable the bluetooth. Is it an error on my side or is it normal ?
I also found the doc about Audio Route changes, that can also be an idea to detect the bluetooth connections/disconnections. Just check the kind of new route and detect the connected bluetooth devices at that time.
In the doc, I also found NSNotification types like IOBluetoothHostControllerXXX but nothing is explained about them. Did someone already used them ?
Is there something better or am I missing something ?
You cannot receive notifications about the connection and disconnection of Bluetooth peripherals generally. You can get connection and disconnection events for BLE peripherals that your app connects to.
For example, if your app initiates a connection to a heart rate sensor then you will get a call to your CBCentralManagerDelegate connection function when the connection succeeds. If that device subsequently is switched off or goes out of range then you will get a call to the disconnection delegate method.
If some other app initiates and makes the connection then you will not get a callback.
As you mentioned, you can monitor audio route changes to infer that a Bluetooth audio device has been connected/disconnected, but this will also fire when headphones are plugged in.

Alerting from a ble device

Do the likes of flic, tile and pebblebee implement their own ble services/characteristics ? Or are they using standard ble profiles ?
I'm building a ble device and would like to make the phone alert/ring when a button is pressed on the device and googling doesn't suggest a standard.
The simple answer, both devices have to have a immediate alert service exposed in order to have 2 way alerting.
I'm using a microchip rn4020 which wasn't scanning the central device for services, once I corrected that i could see the phone app was presenting the immediate alert service.

Can I make a phone call from my iOS app, which is not currently active?

I have a bluetooth device which is connected to the iPhone and has a control button. Pressing this button should make the app to perform a phone call to the previously defined number and establish a voice connection with the device (like bluetooth headset).
From what I've learned, it's not a problem when the app is active, but if it's not? 99% of the time it will be in suspended state. Documentation says, that a bluetooth device can wake up the app from suspended state to perform some data processing etc. But I couldn't find the info about phone calls.
As I understand it, the app can be waken up and perform a phone call, but this is critically important and I need to know for sure, so any information on the matter is greatly appreciated.
You can't use the app to perform the call when it's not active. Instead, you should use Apple's handsfree protocol for bluetooth to perform the call on the bluetooth device itself.

How to send data to an iphone which is turned into a iBeacon?

how is it possible to send data to an iPhone which acts as an iBeacon?
I am looking for an process as the following:
Search nearby iBeacons
Connect to some iBeacon
Exchange data between the devices
Does anybody know how to put the different bluetooth functions together to make
this possible?
thx in advance
Standard iBeacons are transmit-only devices that can be seen by mobile devices, but don't actually "connect" to them or exchange data.
But you can still do what you are asking if you have an app on all devices as well as a web service to do the data transfer. This would allow devices A and B to detect each other when they are nearby and exchange data. Here's how:
Your app on devices A and B alternates between acting as an iBeacon (advertising its presence with an application-specific identifier and a phone-specific identifier) and ranging for iBeacon signals including the application-specific identifier.
During its ranging cycle, your app on device A will detect an iBeacon transmission from device B, which includes both your application identifier and the device identifier of B.
App A then makes a "write" call to the web service with a source of "A" and a destination of "B", along with any data you want to transfer, like "Device A says hello to device B."
The app would also periodically make a "read" call to the web service. In this example, device B would read any information destined for B, and the web service would return a record that device A had send it a message with the data "Device A says hello to device B."
Because the same process is also running on both phones, this communication can happen both ways.
iBeacon is a proximity technology and isn't designed for data interchange. However, since the Bluetooth stack is going to be active on your iPhone acting as the beacon (so it can advertise its proximity UUID), you can use Core Bluetooth to connect to the beacon and exchange data between the devices.
Does it specifically need to use iBeacon technology? The reason I ask is that from reading your description of the process, you could achieve the same thing using iOS 7's Multipeer Connectivity. It's able to abstract out all the technical complexities of connecting 2 iOS devices together regardless of the interface, be it WiFi or Bluetooth. I've managed to build something similar using MCNearbyServiceBrowser, MCNearbyServiceAdvertiser, and MCSession classes.

Resources