buddahbrot
buddahbrot

Reputation: 1288

Can an iOS app use both certificate-based and token-based APNs connections at the same time?

We are currently in the process of preparing an update for an exisiting app, which provides push notifications via Firebase, which uses a token-based APNs connection.

Due to changes in the backend, we want to transition to OneSignal, which is certificate based.

Since the app is going to be released as an update, we want to maintain pushes via Firebase during a transition period, while updated versions should be able to receive pushes via OneSignal.

My question is: can I use both at the same time for one App-ID? Or are they going to interfere with each other?.

Apple's docs mention that

To send notifications, your provider server must establish either token-based or certificate-based trust with APNs using HTTP/2 and TLS.

but don't say anything about implementing both at the same time.

Upvotes: 0

Views: 1191

Answers (2)

Rubycon
Rubycon

Reputation: 18346

You actually can use both of them in parallel.

You also can generate 2 certificates and use them in parallel as well.

You also can use a single certificate/token from many places.

There are no any restrictions with this - certificate/token is only used to identify who you are, your App ID.

Upvotes: 6

Martin Prusa
Martin Prusa

Reputation: 211

Since you've mentioned "receive pushes via OneSignal" I am assuming you are talking about iOS app, but I believe this is more of a backend problem. Because on iOS all you have to do is

  • register for push notifications via project settings
  • ask for permissions (Info.plist)
  • handle in appDelegate func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) and func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error)
  • setup correctly the developer portal for your project (certificates, permisions etc.)

All the push notifications that are coming to the device are coming from APNs, so your app cares neither about the Firebase or the OneSignal.

I believe your app will have OneSignal SDK in it, not the Firebase after the update.

So I think you need to handle the sending of push notifications via Firebase and OneSignal on the server during the transition period. Your server needs to communicate with both of those services at the same time. APNs will handle the rest of the delivery for you.

You can always use sandbox servers for a tryout before production.

Upvotes: 0

Related Questions