Speak now
Please Wait Image Converting Into Text...
Embark on a journey of knowledge! Take the quiz and earn valuable credits.
Challenge yourself and boost your learning! Start the quiz now to earn credits.
Unlock your potential! Begin the quiz, answer questions, and accumulate credits along the way.
General Tech Bugs & Fixes . 1 year ago
Turn Your Knowledge into Earnings.
I'm implementing Firebase in my app for push notification. Previously, the app has sent device token to own server for them to configure which device to send a push notification to.
1) Now in Firebase, there is something called registration token. So to maintain the same function of server handling which device to send a push notification to, should I send the device token from didRegisterForRemoteNotification or the firebase registration token from the didReceiveRegistrationToken delegate?
In my app I am using this. send it from there,
import UserNotifications import Firebase import FirebaseInstanceID import FirebaseMessaging func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { InstanceID.instanceID().instanceID { (result, error) in if let error = error { print("Error fetching remote instange ID: \(error)") } else if let result = result { print("Remote instance ID token: \(result.token)") // save in userdefault and fetch when you user register and login, Constants.kUserDefaults.set(result.token, forKey: appConstants.fcmToken) } } Messaging.messaging().apnsToken = deviceToken as Data } // and i also use func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String) { print("Firebase registration token: \(fcmToken)") let token = Messaging.messaging().fcmToken print("FCM token: \(token ?? "")") Constants.kUserDefaults.set(token, forKey: appConstants.fcmToken) }
General Tech 9 Answers
General Tech 7 Answers
General Tech 3 Answers
General Tech 2 Answers
Banking, Finance & Insurance
Mobile Technologies
Career Talk
General Tech
Commerce & Accounting
Career Talk0 Answers
General Tech0 Answers
Digital Marketing0 Answers
Internet of Things0 Answers
Interview Questions0 Answers
Your experience on this site will be improved by allowing cookies.