Apple Push Notifications in Tvos

Apple Push Notifications in tvOS

tvOS supports only 2 types of notifications: badges and content-available. So you need to send one of these two types to APNS. Any of these types notification only changes badge number on App Icon. And only the lastest notification will be delivered to your application when you open the app. There is no visual presentation of notification as it was on iOS
How it looks see on presentation from WWDC 2016/Session 206/tvOS, start watching from 21:20

Sample Image

Sample Image

UPDATE:
On tvOS 11 appeared Silent notifications which wakes the application up and allow to refresh content in background

Sample Image

WWDC 2017 watch from 7:50

TVOS remote notification replacement

What part of the registration errors out for you? Notification dialogs and banners may not really make sense on tvOS, but can you send a silent push notification? All you need to do to register for these is

[application registerForRemoteNotifications];

You do not need to display the request dialog to the user for permission for silent notifications (you do need to have the remote notifications entitlement though.)

According to Apple's documents here, they allow CloudKit. CloudKit subscriptions rely on silent push notifications that I would assume would work on tvOS (without them it would severely cripple CloudKit)

If that still does't work, then you could create your own long polling connection (essentially, you would be making your own custom push notifications). It would only be able to send messages to devices that have the app opened however.

Other services like Apple push notification

I think you got it a bit wrong here. APNS is the service that will communicate with the device in order to send push notification. Any other 3rd party libs are using APNS in the end, they just offer custom handling or other features (like deep-link, tracking of push notifications etc).

I don't know about macOS but on iOS you can receive push notifications for apps that are not distributed trough AppStore. For example you can create an enterprise account, which is a bit more expensive than a normal one(like stated on docs) and you can sign the app with the certificates & profiles from that account and the push notifications will work for sure.

The push notifications work in sandbox & production mode on apps that are not submitted to AppStore. The only difference in these is the way you distribute them, using enterprise certificates (you can install the app in any number of devices) or normal certificate (you can install the app on max 100 devices).

And the final point, there's no other way to receive push notifications other than APNS. You could try to implement a copy of this process but with no success, at least on non-rooted devices, simply because you'd have to create a socket-like communication between app & a server, which would run in background, but the OS will kill your process pretty soon & bye bye socket.

Sending push notifications directly to watchOS 2?

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.



Related Topics



Leave a reply



Submit