Reputation: 6087
I'm working with a remote web API developer, currently we're working to send push message from the server to iOS and Android device. We send our device token via OAuth API. (For iOS, device token is gotten from registering remote service with APNS service at AppDelegate launch). The weird thing is, Android can get the push notification, but iOS devices don't. But when I tried using the Firebase console -> grow -> notification -> New Message -> and target all the iOS device, all the iOS device registered to the push notification receive the push notification. Can you help me point out where the problem is? The web server is using nodeJs.
Things I have done, which I did according to this tutorial:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
if #available(iOS 10.0, *) {
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
// For iOS 10 data message (sent via FCM
Messaging.messaging().delegate = self
} else {
let settings: UIUserNotificationSettings =
UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
application.registerUserNotificationSettings(settings)
}
application.registerForRemoteNotifications()
FirebaseApp.configure()
return true
}
From all this preparation, if I run the app in real iOS device, and then lock it, any message I broadcast to iOS device in the Firebase iOS app will shown in the lock screen notification. But not message from the web API that's directed toward the account logged in the app (which is directed to all the android and iOS device that logged in using that account -- it's shown on the android devices, but not on iOS devices).
I'm new to FCM. I usually use APNS. I probably don't know much about the terms to fix the server side as I don't understand nodeJs much, so if you have some suggestion about the server side, please be elaborate, so I can discuss it with the web API dev. Thanks for your help.
Upvotes: 0
Views: 916
Reputation: 6087
Turns out what I need to send to the server is not APNS token, but Firebase token, found in here:
https://firebase.google.com/docs/cloud-messaging/ios/client#monitor-token-generation
Upvotes: 1