IoT device that use iPhone as Gateway - ios

I'm developing an IoT device that will connect to iOS via Bluetooth.
I've seen some smartwatches that uses the iPhone as a gateway to perform Internet connection tasks like getting weather data, without the need to open a particular app.
How can this be achieved?
Is there any supported Bluetooth Profile that iOS support for that functionality?

There is a way to allow you to listen to Bluetooth activities in the background as well. Check out this documentation.
And, for the part about running tasks without the app running in the foreground, you might want to check out the background execution API (Only in iOS 13)

Related

How to save a bluetooth connection to settings using CoreBluetooth and Swift

I have a device I want to keep connected to my iPhone while the app I'm building is not running. Currently, I'm at the point where I connect to the bluetooth device, hop over to settings, and can see the device there (I'm using the Nordic Thingy for testing).
I know it is possible because I have a Bose app that does the same thing with my headphones: it doesn't need me to have the app open or even in the background for the headphones to work after I've connected to them via the app.
I've looked into how to persist the bluetooth connections with my team, but we've only found guides similar to this one on how to save data in the background for autoconnection when the app is open again, or guides on how to work with bluetooth devices when your app is in the background.
Is there a way to mimic Bose's behavior here?

Connect to a backgrounded iOS app acting as a peripheral from a macOS app

I have an iOS and macOS app that make heavy use of Core Bluetooth. The core functionality of the app involves having a central device (CBCentralManager) connect to a peripheral device (CBPeripheralManager), retrieve some data, then disconnect. Either device, whether macOS or iOS can act as either a central or peripheral depending on who needs the data.
At first I thought there was an issue with my code, but after testing the app with two iOS devices, one is able to connect and extract data from the peripheral device even when the peripheral device is locked and the app is in the background. Now according to the docs concerning background advertising on iOS under "The bluetooth-peripheral Background Execution Mode" this is kind of expected:
...they can be discovered only by an iOS device that is explicitly scanning for them.
Is there any way to have a macOS app discover peripherals even when they're backgrounded? I'm sure the code I've written is correct because it's the same across iOS and macOS.
Update 1
I believe that this might be possible just unsure how to approach the issue. Using Apple's Bluetooth Explorer on macOS, I am able to find the desired device AND I'm able to see and read data for my custom service.
This finding is validated from logs from my iOS device about the read requests which are from my peripheralManager(CBPeripheralManager, didReceiveRead: CBATTRequest).

Communicate iOS with ODB 2

I need to create an app read info from the ODB2 device installed in a car and show the data to the user but in a "funny" way. So I need to read the data and connect the phone to internet simultaneously.
I found this questions:How to communicate with OBD II using bluetooth or wifi using iphone , but is from 2014, maybe now there is something.
I've been looking for an ODB2 device that can communicates with iOS via Bluetooth.
I found a couple of devices that can do the trick (like viecar or bluedriver), but using their own apps. Also, I found some devices that can talk with iOS via WiFi, but it would be annoying to be connecting your device to WiFi, then turning off WiFi and using mobile data again...
So my questions is:
Is it there any way to communicates via bluetooth with an ODB2 devices? Or better said, is it there any ODB2 device that can be used via Bluetooth with iOS?

Enabling MQTT Service in Background in Hybrid Applications for iOS environment

I'm using MobileFirst Platform 7.1 with Paho MQTT (Internet of Things), I'm trying to implement a Hybrid Application with mqtt for Android and iOS.
I have tested the app in Android and it is working as expected, when it is in the foreground and background,
While in iOS, it does not work as expected. It works correctly in the foreground, but not in the background. I was testing using the iPhone Simulator of XCode and iPhone 6.
I found a project which implemented with MobileFirst and MQTT. from https://developer.ibm.com/mobilefirstplatform/documentation/integration/mq-telemetry-transport/
i am just adding host and port number and adding android,ios environment.but same problem facing android working iOS not.
at this moment what can i do ?
UPDATE:
in iOS, it works correctly foreground.but when i send background the "MQTT client" connection lost form broker.
this method fire :
this.client.onConnectionLost = function() {
alert("Connection lost!");
};
on the other hand , android , windows it work perfectly for foreground and background
For example :
I have a room there have a PIR sensor. it work like publisher . my application user is a subscriber .
when user out the room that that time she open application,subscribe and
send application background.
anytime someone entire the room that time , she will be get a notification.
Details on how to run in the background on iOS can be found here. This link also lists the actions that Apple allows to run in the background, if your app does not meet those criteria then it is likely to get bumped from the app store.
The list also shows which UIBackgroundModes to place in your Info.plist to flag that your app needs background access.
I can not found at least one way to mange it for hybrid application ,tried with several way ,failed and mange it easily for native application MQTT iOS background.
Todos
Plan support for new platforms (iOS, Windows Phone)
Add background service support in Android version
more check this link https://github.com/arcoirislabs/cordova-plugin-mqtt

Restoring Microsoft Band connectivity on iOS

I am working with the Microsoft Band SDK on iOS and I have a question on restoring connectivity in the background when using the Band SDK. With the Band SDK you connect via Microsoft's API rather than directly to the bluetooth device using Bluetooth Core on iOS. This gets you several events including device connected, device disconnected, etc.
The problem I am having is how to restore a connection if the device disconnects, such as going out of range. I would like to be able to restore the connection when my app is in the background without having to bring the app back to the foreground. I have added the bluetooth background modes to my Info.plist, which allows me to process events from the device in the background but any attempt I make from the background to restore the connection never seems to complete until I bring the app to the foreground.
All the documentation on state preservation with Core Bluetooth seems to only apply if I am managing the device myself using the CBCentralManager, however since I am using Microsoft's Band SDK as an intermediary I don't believe I can use this.
So any help on how I can restore the connection via the Band SDK API while my app is in the background would be appreciated. I know the correct API calls to make I'm just unsure how/if they can succeed while my app is in the background.
Direct access to the Band via Core Bluetooth is not supported for 3rd party apps. So, managing the Band from CBCentralManager will not be possible from your app.

Resources