Wake up an App using an hardware interrupt - ios

Is there a way I can program an app to wake up when the device receives a specific hardware interrupt?
For example, I created an IOT device which connects to the lightning port of my iPhone and I programmed my IOT device to send a specific device code (as an interrupt) when connected.
Will it be possible to code in way that the IOS detects this device code and knows that it has to wake a specific application (built for the device)? My use case is to make the application start automatically when the device is connected (even if the phone is in a locked state).

Related

BLE device re-connects after cancelPeripheralConnection (How to forget a BLE device?)

I have a BLE device that connects to an iOS device after it has been chosen through a fairly standard user interface (tap on the device entry shown in a UITableView).
The connection is simple enough- some internal processing followed by calling the CBCentralManager's connectPeripheral(peripheral: options:).
There is a requirement to 'forget' the device (so that the iPhone won't connect to it automatically again). I call the cancelPeripheralConnection(peripheral:), however the device still connects back to the phone automatically.
How can I stop the BLE device from automatically re-connecting after the cancelPeripheralConnection(peripheral:) method is called?
There is no way to forget a device using code. You have to manually go to the settings and forget the device.
The system will automatically connect to a paired device when the bluetooth is turned on or if the device initiates a connection. Are you calling connect after the cancelPeripheralConnection call?

iOS app listening to bluetooth connections started from other device

I am working on an iOS app that will interact with an external bluetooth device. The device must start the bluetooth connection with the iOS device and iOS should call my [perhaps closed] app to process the request. This should work even if the app was not opened since reboot. Is that possible?
I need it to be in real time, It's not a solution to pull the data from the iOS app periodically, the connection must be started by the external device.
In Android this is very easy using an BroadcastReceiver, the OS receives the bluetooth event of the device trying to start a connection, calls my declared BroadcastReceiver and it starts my app.
Thanks

iOS - wakeup application when a/any bluetooth device is connected

Is there any way to "wake-up" (relaunch) an iOS application (a background task actually, not to show the application) whenver a bluetooth device is connected?
For example, the iOS OS kills the application due to memory lack. Then a couple of hours later the user connects his bluetooth device. Can the iOS notify my application that the bluetooth device is connected and run a background task?
In Android I see that I can create a BroadcastReceiver that is registered for when a bluetooth device is connected. I need something equivalent to that for iOS.
If you have a pending connect for your BLE peripheral and you have specified BLE central background mode then yes, your app will be relaunched. You also need to implement state preservation and restoration as described in the Core Bluetooth programming guide in the event that your app is actually killed (not just in the background).
Note that in iOS a user cannot connect to a BLE peripheral directly - your app is responsible for identifying the target BLE peripheral and issuing the connect command. This is described in the programming guide.

Communicating with a Bluetooth Classic device in iOS when the app is in the background?

I'm working on iOS development for a bluetooth peripheral. We want the (already paired) device to connect when a button is pressed on it, and this will cause the app to execute some code. Is it possible for the app to detect that the device is connected, even while in the background?
Also, is it possible for the app to bring itself into the foreground when this is detected? Would I need to be a member of the MFi program to do either of these things?
You will be able to detect that the device is connected in the background using Bluetooth 2.0, however you must include the App communicates with an accessory string under Required Background Modes in the app's plist.
So yes, the first part of your question is doable. However when you say: "We want the (already paired) device to connect when a button is pressed on it", it is important to note that this functionality must be built into the device's firmware. The app can always be searching for it, but the device will not be able to communicate with the phone until it connects. Therefore, the button must wake up the device and signal that it now wants to connect.
For the third part of your question, you will not be able to bring the app into the foreground without the user opening the app.
Btw, CoreBluetooth is the Bluetooth Low Energy framework for iOS. It is completely different from Bluetooth 2.0.
as ttarules told you iphone can't connect automaticly to a paired device.
I don't know what kind of bluetooth receiver have you in your device but generally you can set up a method of "AUTOCALL" that automatically call a paired device (in this case an iPhone).
When you (your iPhone) come around the device it automatically establish a connection!
If you set all the parameters correctly in the bluetooth module you can make sure that the iPhone shows a message like this: "YourDevice would like access to YourApplication" when the connection is established.
this way helps the user to use your application and you can run the code you mentioned above when the app start.

iOS: Automatically reestablishing Bluetooth BLE connection when in range

Is is possible to "pair" a Bluetooth BLE device such that they automatically connect when in range? (ie. an iPhone app sets up a connection to the Bluetooth device and from then on, the iPhone automatically reconnects to the device if in range, even if the app hasn't been opened in days and is fully closed).
Once reconnected, the device could either using Event Backgrounding to prompt the user to open the app or otherwise interact with a possibly backgrounded app (as described here).
Anecdotally, I've used Bluetooth keyboards that automatically reconnect to my laptop when back in range. These are not necessarily BLE devices, is this something that's possible in BLE land?
Could this be possible if the iPhone were the server instead of the device? What if this were done using traditional Bluetooth under the MFI program?
There are number of relevant comments here and on the Apple Bluetooth-dev mailing list, but nothing that cleared it up for me. Thank you for your help.
I posted my question on Bluetooth-dev, I'm leaving the response here for posteriority: http://lists.apple.com/archives/bluetooth-dev/2012/Sep/msg00117.html

Resources