Hey guys I’m trying to add Push Notifications on my project but I can’t get the Device Token. I also noticed that when I changed the AppDelegate.swift file, XCode is giving me a deprecation warning. Could that be related?
The warnings are:
‘InstanceID’ is deprecated: FIRInstanceID is deprecated, please use FIRInstallations for installation identifier handling and FIRMessaging for FCM registration token handling.
‘instanceID(handler:)’ is deprecated: Use Installations.installationID(completion:) to get the app instance identifier instead. Use Messaging.token(completion:) to get FCM registration token instead.
The docs were updated long ago, if you are seeing that code you might have then cached.
Or you might be checking v2 docs, those docs still use the old code, but tell you to use an older version of firebase where it wasn’t deprecated
If you are in Capacitor 3 follow the Capacitor 3 guide, if you are in Capacitor 2 and want to use the new code you can check the Capacitor 3 guide but change only the Firebase code and not the Capacitor code.
Hello @iconio, I used to face the problem of using push notifications of Capacitor version 3. But I found the way out with these docs from a great teacher of the ionic community Mr. Simmon.
There is a tutorials link for your: https://devdactic.com/push-notifications-ionic-capacitor/
I was afraid of the reason why you are not getting any tokens. In my guess maybe because you didn’t make a requestPermission().
In my case, the docs of the link above do not work for me so much, cause I make “requestPermission()” still don’t get tokens.
So I rely on my logic. I must ask about checkPermission() first, and then asking requesPermission() if App wasn’t permission plugins yet.