We implemented Push notification in our project with Firebase notification. Our current app (which is available in market) is receiving the notification and showing the notification in device (Badge, Alert). When we override the existing application with the new update (With new updated payload), the app getting new "Device Token" and the device not showing the push notification at anytime. Even, the firebase delegates getting called when the app is in foreground.
We tried the old app Firebase device token in the new update app. We are receiving the push notification perfect.
We tried the new device token in the new updated app. We are not receiving the push notification at any time. Also, we are receiving
two different device tokens.
Rechecked the "GoogleService-Info.plist" and the configurations are perfect.
Can anyone help on this? Thanks in advance.
Try to add FirebaseAppDelegateProxyEnabled in your info.plist file.
FirebaseAppDelegateProxyEnabled = YES
Hope this helps.
Related
This bounty has ended. Answers to this question are eligible for a +500 reputation bounty. Bounty grace period ends in 5 hours.
Scorb wants to draw more attention to this question.
I have a cross platform flutter app. I am using FCM to send notifications and they are not arriving on the iOS app in any state (foreground, background, terminated). I am testing on a physical device.
The notifications work on Android, so I know the topic subscription and send code is correct.
I have followed these steps for configuration defined here...
https://firebase.flutter.dev/docs/messaging/apple-integration/
To verify I have:
added and initialized firebase using google-services-info.plist.
created and added my APNS key
created the app identifier in the Apple Developer center and confirmed it matches my apps bundle id (and added push notification
capability for the identifier.
added push notification capability to the app in xcode
added background fetch and background remote notification capabilities to the app in xcode.
It seems like I have addressed every step to configure FCM on iOS. But none of my notifications arrive.
When the app is minimized, no system tray notification is triggered, and when in the foreground the FirebaseMessaging.onMessage is never triggered, like is is when on Android.
An important note is that this is the second iOS app added to this project, and the first iOS app works correctly. Though there is no indication that there are any special steps for a second app.
We saw a similar problem (for a native iOS app) where FCM would deliver to one app in the project but not the other. The mistake we made was not repeating the configuration in Firebase for the other apple bundle id since each app in our project has a different bundle id. Given it works for one of your iOS apps but not the other on the same project, it sounds like you've got the same issue.
Also, a good diagnostic step is to use the Firebase Console to manually send off a Push Notification to a particular app. It means you can then discount errors further upstream in your backend that may not have caused FCM to be invoked.
Have you tried to send testing notifications via firebase console?
You can log your device token in your app.
Background notification must work if you have done correct with firebase and APN settings despite without implementing some methods of AppDelegate file for remote notification on the next step.
Your question is very blur to have a specific answer but you can separate your concerns to find the issue and then try to resolve that:
1. Make sure about the APNs configuration
First, try to send a notification to your iOS app, directly using the APNS key. If you get the notification, it means you have configured the APNS correctly
2. Make sure about the firebase setup
Check with both the Android and iOS app and see if there are connected to the firebase console. You can use the real-time event to confirm that.
3. Make sure you have implemented the correct methods.
Firebase and apple have different methods for push notifications. Make sure you are implementing the correct one. Also, it may vary based on the configuration file of firebase. search for iOS firebase swizzling for more information
4. Make sure you got the right permissions from the user
You should get the notification permission from the user before trying to show any notification. Make sure you've done that
Note that you may have already tried some of these but I've mentioned them for the sake of completeness. Hope it helps you and others.
I have an app which had 7,000 users subscribed on Pushwoosh. We switched from Pushwoosh to OneSignal and updated our app with OneSignal documentation. New users downloading our app are getting subscribed to our push notifications but the old ones are not getting updated.
Do we have to trigger permission to send push notification again ? Does Apple allow to do so ?
What is the workaround this ?
Notification Permissions & APNs Token
Notification permission is granted at the app level, so no matter what SDK / library is in your app it can read if the user has already accepted notifications and the APNs token.
The OneSignal iOS SDK does automatically check if permission is already granted and attempts to register for an APNs token. The OneSignal SDK will register the device with the app_id you put in your app and create a new player if it is the first time you opened the app since you added OneSignal.
APNs will return the same push token each time unless the user has fully uninstalled and reinstalled your app. However just in-case Apple were to deiced to rotate the token the OneSignal SDK does call the APNs register API to be sure.
Finding & Fixing The Issue
To find the issue I recommend the following;
Only include one push notification SDK in your app at a time, it possible for SDKs to have conflicts due to method swizzling or other possible issues.
In this case remove the Pushwoosh SDK if you using OneSignal.
Try to reproduce the issue on a test device by upgrading your app.
When testing the upgrade, I recommend enabling verbose logging in the OneSignal SDK.
OneSignal.setLogLevel(.LL_VERBOSE, visualLevel: .LL_NONE)
Also observe at this point if you are getting a user on the OneSignal dashboard.
If there was an issue getting an APNs token by the OneSignal SDK there will still be a user, they will just show as unsubscribed with details why.
This all depends on how you are getting the device push token from the user's device and sending it to OneSignal. A common mistake is to only get the device token the first time the user accepts the notification permission prompt. However, the device push token is subject to change randomly at any point in the future which can result in outdated device push tokens on the server used to send notifications.
To combat this, it is suggested to register for push notification every time the user launches the app. While this won't re-prompt them to accept notification permissions, it will fetch the device push token again. The push service you are using should then be updated with the new device token.
TL;DR: at every app launch register for a device push token and send it to your push server.
I am implementing Pushnotification on my project.I have Connected my project to firebase and than if I push notification from firebase Cloud messaging than notification properly coming in my Real-Devices. but if I test on my real-Device to Real-Device notification than Notification is not Coming.
I dont know how to present Push Notification.
Please any one help me.
As per your description I can understand that the issue might be from backend. Please confirm with him 2 things
Server key he added is correct from your project in firebase console.
Are you setting him correct notification token.
The notification code of firebase token added is correct.
I have shared some php push notification sending link you can show to backend. But from app side things required are
- Push notification enable from capabilities.
- certification which is uploaded to firebase is proper.
- firebase token is generating or not
A FCM firebase notification push message was received from the remote message function but does not push on my device. I have set the firebase proxy delegate to yes.
Rembember that push notification not showing on Simulator and when the app is running, just hide app and try send a new notification.
You need to make sure certain things.
You are not testing in a simulator. Notifications are not allowed there.
Payload used to be proper. https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html
Permission for notification should be given.
If the user turned off (assuming the user accepted to receive Push Notification in the app, but went to Settings to turn it off) Push Notification in Settings for an app, does this app still receive data sent in the notification when opening the app. This app does not receive/retrieve/request data in any other way except Push Notification.
The answer is simple: No, it doesn't.