Locked iOS device scanning for BTLE devices - ios

Can an iOS device scan for presence of Bluetooth LE devices while locked and then respond to them by opening the app?

The scanning can definitely happen in the background.
In order to get the functionality that you're talking about the comment by owen is correct. I'll expand on it a bit.
What we do is when we recognize a BLE device that we're interested in and would like the app to open we send information to our server, from where we have the option to send a push notification if the user wants. This could probably also be achieved with a local notification set a few moments in the future. From there the standard rules apply for push notifications, if they opt to look at it your app can be opened and you can respond to the proximity of the BLE device that initially triggered. The user always has the option to ignore the notification though.

Related

Intercepting other apps push notifications on iOS with Swift

I need to intercept the following push notifications from my application:
SMS / iMessage
WhatsApp
Telegram
I will be sending those directly to show on an external device display via Bluetooth.
I see Pebble are doing this:
https://help.getpebble.com/customer/portal/articles/1191239-setting-up-ios-notifications
Is this accomplishable? or Apple's sandbox policy prevents me?
If Apple are the problem, how does Pebble handle this?
Thanks :)
You probably want to look at ANCS.
"The purpose of the Apple Notification Center Service (ANCS) is to give Bluetooth accessories (that connect to iOS devices through a Bluetooth low-energy link) a simple and convenient way to access many kinds of notifications that are generated on iOS devices".
I presume this would require custom code to be written on the Bluetooth device, so it depends what you have access to. But as far as I'm aware, this would be the only way to send notifications for apps other than your own to be sent to a connected Bluetooth device.

Reconnecting an iOS app to a paired BlueTooth device?

As you know, after some period of inactivity, a Bluetooth device will disconnect from an iPhone. The user will then have to go back to Settings in order to reconnect the device.
1 - Is it possible for an iOS app (when it enters foreground) to force the reconnection to a paired Bluetooth device, without any user input?
2 - Is it possible to force the reconnection to a paired Bluetooth device, but during an app wake-up state from an iBeacon signal (matching UUID)?
Yes, you can use CoreBluetooth APIs to connect to a Bluetooth LE device without user input. It doesn't have to be "paired" in the same way as a Bluetooth Classic device. To do this, the Bluetooth LE device should expose a GATT Service UUID that the mobile app can recognize, and when it discovers this Service UUID, it can simply connect programatically.
When you use CoreLocation APIs to wake up your app based on iBeacon detections, the app is launched into the background temporarily. You can send a local notification to the user to try to get the user to tap on it and bring the app to the foreground, but if the user does not, app background rules still apply.
Bringing together #1 and #2, you should understand the rules Apple places on using CoreBluetooth in the background. See Apple's docs for The bluetooth-central Background Execution Mode. It would be possible to make a connection in the background if you get the proper app permissions.

Pebble Watch: Send notification to wake up iPhone (Watch -> Phone)

SITUATION: None of iPhone's physical buttons (except volume) are operational. Thus, can virtually only activate screen by receiving a notification.
Instead of simply getting the buttons repaired, I want to see if it can be an opportunity to learn.
PROJECT: Make a simple Pebble app in Cloud Pebble that will send an (arbitrary) basic notification to my iPhone, waking it up. That way, I can activate the screen remotely by, for example, clicking the Pebble middle 'Select' button. [SMS may do, but seems to be a long route compared to Bluetooth communication.]
Possible?
You can easily make an app that will use the Twilio API to send yourself an SMS. You could also use one of the services that sends you push notifications.

Is it possible to check if pebble is connected to ANCS service from an iOS device?

What I want to do is to notify user from background that something happened. On iOS device this is done using UILocalNotification. I also have an app on pebble watch to which I send a notification and user can interact with it.
The issue is that starting with iOS 8 pebble also shows all notifications from Notification Center, this way the notification gets duplicated.
To make things worse, pebble actually creates two different connections: (1)a simple Bluetooth link for normal communication and (2) a BluetoothLE for ANCS service: this means that the watch can be "connected" but no connection for ANCS services is established.
Is there a way to determine this, so that I don't send the notification manually if pebble already receives it from ANCS services?
p.s. I do check if the device has BLE (using CBCentralManager), so this partially solves the issue - I send manually the notification for the devices that don't support BLE at all.

Send data from device to device

I'm working on local simple chat app for my small company that sends messages from device to device.
Each device is assigned a unique number (for example, 111,112,113, ...).
I need a way to send a message from device (111) to device (112) directly.
I used Push notification, it worked fine, but Notification Settings has to be enabled for the app.
Is there an alternative way to send date from device to device directly?
One option is to use Bluetooth communication via GameKit. Here's the code for a simple chat application using that approach. The example is a few years old but is still relevant:
http://www.devx.com/wireless/Article/43502

Resources