Intercepting other apps push notifications on iOS with Swift - ios

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.

Related

Push Notifications without APNS

I work perfectly with Push Notifications for iOS using APNS. So for some customers, I need an on-premise or local solution, where I could send notifications to the device without APNS and without dependence on the internet. Somebody knows? can you help me?
Not possible. You cannot get notification from APNS without internet.
What you can do to accomplish this is you send message from your server to the app while it is in background mode and generate local notification accordingly.
Let me clarify your question.
"Locally" means: you got either no internet connection, a local network without connection to APNS OR the users simply did not register for push notifications.
1. iBeacon with Local Push Notification
So, here is an alternative, and that's kind of NOT what it is basically used for, but as you may know. iBeacons can be used to transport small data chunks, very very small ones. If your users did enable location services, you could include these for your application to trigger certain events (in this case, a very small notification that users came into range of a point of interest).
Downside: The application bundle requires either a static "notification text" to beacon mapping or you have to dynamically download the mapping from a web source, so you could update the notification's text.
2. Bluetooth with Local Push Notification
Another alternative would be to use bluetooth instead.
Devices could auto connect to your Bluetooth Station "Peripheral" - These devices now (with the help of your app) would register to a broadcasting characteristic of your Peripheral.
The peripheral could send messages to the registered devices.
If now the device does receive such a broadcasted message, you could perform a local push. - Without any network connection, just with the help of bluetooth, which itself also requires user permissions, of course.
3. Internet Connection / Silent Push with Local Push Notification
If your application of course had a working internet connection, you could avoid the APNS from Apple and send your own notifications to the device as silent push notifications.
As of iOS 14 this is available through Local Push Connectivity, but you will require the App Push Provider entitlement that you must apply for specifying why you are unable to use APNS.
Apple sample code is available here.
APNS works only with internet. If you need to push a message to the user without internet one solution (probably only solution currently) is using SMS api. But that requires user mobile number. Using URL Schema the user can open your app from the SMS message.

Catch all iOS push notifications like Pebble is doing

Is there a way to ask the user and give access to the iOS notifications, so that the app can read/forward all iOS Push notifications, like Pebble is doing? It's not a security issue because I want to ask the user if I can...
In my case I want to forward the push notifications to a web server.
There is only one post here but it's about Bluetooth, and I don't find enough documentations..
The idea:
Send all my notifications to a webserver so that my Raspberry Pi can show them, on a LCD screen or just with a LED.
No, Apple would not allow this for an app, because of privacy.
You would need to connect your raspberry to your iPhone over bluetooth, then you could work something out, like Pebble.
Another way is to jailbreak your iPhone, and then figure out how to get access to notifications.

iOS: use VOiP notification instead of "normal" notif

We just add VOiP capability to our app (messaging app), now we will use VOiP (PushKit Framework).
Can anyone tell me if we can use only that notifications (VOIP notifications)? Meaning even for text message for example (not for a call)? I talk about Apple Appstore Guides, they can reject the app or block the notifications if they found that we use that notification to notify the user about other things then a VOIP call?
The answer is yes, i used the VOiP notification for a no-voip notifications (like a text message) and Apple accept the app (and i can can confirm, after some tests, that whatsapp use the same thing as my app).
You need to implement VOIP functionality in order to not to be rejected. I've tried to use it for messages between users and it was not approved. So if you really don't have VOIP functionality, modify your server to your needs.
I have also implemented VOIP push notification in our app. But app is rejected by app store by saying
"We continue to find that your app declares support for VoIP in the UIBackgroundModes key in your Info.plist, but it does not include any Voice over IP services.
Please revise your app to either add VoIP features or remove the "voip" setting from the UIBackgroundModes key.
We recognize that VoIP can provide "keep alive" functionality that is useful for many app features. However, using VoIP in this manner is not the intended purpose of VoIP.".

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.

Resources