Friday 31 May 2019

How to make firebase push notifications work

I have spent about 2 days going through firebases documentation, asking questions and looking at others and following youtube/medium tutorials and more. Here is a github project with my full app delegate, so that all my code is visible.

But I am yet to figure out how to be able to send a notification message from firebase cloud messaging. I have setup Apple push services have gotten and inputed auth key into firebase and written code in my app delegate seen here

Can someone let me know what I need to do to make it work? What have I missed?

Here is my didRegisterForRemoteNotificationsWithDeviceToken method:

    func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    Messaging.messaging().apnsToken = deviceToken
    let tokenParts = deviceToken.map { data in String(format: "%02.2hhx", data) }
    let token = tokenParts.joined()
    print("Device Token: \(token)")

}

Update:

I have followed again this whole documentation by firebase and still sending notifications from fire cloud messaging does not work.

Clearly however the code is running given that 2 lines I have which save the token to firebase successfully save the token.



from How to make firebase push notifications work

No comments:

Post a Comment