Search code examples
push-notificationgoogle-cloud-messagingapple-push-notificationspushy

How Firebase push notification work on IOS?


I want to create my own push notification mechanism for my own iOS applications.

I compared some services like pushy.me or Google Firebase. I think Pushy is the only service that can push notifications independent from Apple APNs, but it uses simple HTTP long-poll requests to receive notifications (in the iOS SDK).

But how does Firebase work? Does it still depend on Apple's APNs? How will it affect my battery life?


Solution

  • Firebase Cloud Messaging (FCM) delivers push notification to iOS devices via Apple's Push Notifications service. Also FCM extends functionality of push notifications. How FCM extends?

    • FCM works with iOS and Android. Cool feature if you have the app for both platforms;
    • Don't need to develop backend for sending notifications, storing pn tokens etc. Just register your app in the Google Developer Console and follow User Guides. For sending a push just execute request to https://fcm.googleapis.com/fcm/send with params;
    • Broadcast notifications. The app subscribes to a topic and then you can send a notification to all topic subscribers. Very cool;
    • Upstream messages (send data to the server)

    Also Google has others services you can extend FCM with. For example Cloud Functions.

    I didn't find that FCM integration take big affect to battery life in my apps.

    UPDATE: FCM framework sends push notification token (and other info) to Google services. Also as I mentioned above you can subscribe app for a specific topic. Than Google knows which device needs to send a push to. There is a possibility to setup FCM in iOS automatically(with using method swizzling). FCM exchange AppDelegate methods and knows your's device pn token.