Send remote notification to apple watch over wifi - ios

I'm developing an app with a watchkit integration and am trying to get the watch to receive a push notification over wifi even if the phone is paired with is disconnected (in this case in airplane mode).
But notifications are not going through to the watch when I try to send them to the paired device token. Which I suppose is to be expected. But is there a way to send a notification directly to the watch? Without having to rely on the watch being connected to the phone?

Accordingly with their doc it seems impossible for the watch to receive remote notifications if the phone is disconnected.
To receive SMS from third-party apps, MMS from third-party apps, or push notifications from third-party apps on your cellular model of Apple Watch, your paired iPhone must be powered on and connected to Wi-Fi or cellular, but it doesn't need to be nearby. You also need to be signed in to iMessage on your iPhone.
From: https://support.apple.com/en-us/HT205547

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.

Sending push notifications directly to watchOS 2?

On iOS, we can register for push notifications using the registerForRemoteNotifications method on UIApplication.
I want to create a watchOS 2 app that will work even if my watch is not connected to my phone (but is connected to Wi-Fi). I would like to send push notifications from a server to the watch directly. Is there a way to do this?
If so, what are the equivalent of these methods in a watchOS 2 extension?
application.registerForRemoteNotifications
application(:, didRegisterForRemoteNotificationsWithDeviceToken:)
application(:, didFailToRegisterForRemoteNotificationsWithError:)
application(:, didReceiveRemoteNotification:)
If not, what are my other options?
Currently there is no way to directly get notification from server on watch. As mentioned in Notification Essentials for watch
Apple Watch displays local and remote notifications only if the
containing iOS supports them. For information about how to support
local and remote notifications in your iOS app, see Local and Remote
Notification Programming Guide.
This also mentioned that
When one of your app’s local or remote notifications arrives on the
user’s iPhone, iOS decides whether to display that notification on the
iPhone or on the Apple Watch
Now there are some scenrio in this, if your phone is active and notification arrives, it will be received on phone. but if phone is locked and watch is active and then notification arrived it will be displayed on watch.
It is also mentioned in Apple Push Notification Service Doc that
Apple Push Notification service (APNs) is the centerpiece of the
remote notifications feature. It is a robust and highly efficient
service for propagating information to iOS (and, indirectly, watchOS),
tvOS, and OS X devices.

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.

How to read push notifications from other apps in iOS

I wanted to know how to be able to read and get the contents of another app's push notification in iOS. Such as a push notification from Facebook Messenger, or Twitter.
I know this is possible because that is exactly what the Pebble Smartwatch iOS app does. It intercepts the push notifications of the iPhone and sends them to the smartwatch over Bluetooth.
Devices such as the Pebble, use the ANCS service with Bluetooth. An app cannot directly access the notifications for/from other apps.

Locked iOS device scanning for BTLE devices

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.

Resources