-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expo-notifications FCM V1 Migration Tracking Issue #28656
Comments
Something else I noticed that might be worth noting is that notification images (not icons) don't seem to be working when the app is in the foreground. Edit: Just to clarify, I tested this by sending the request to the FCM V1 api directly |
To add on to "the notification icon is not working", on Android I'm finding that the icon displays when the app is in the foreground. But I get a blank circle as an icon when the app is in the background This is happening with a development build |
No issue with the icon when we add the correct name/value pair on the Android manifest but it seems there is no "plugin" on the package expo-notification or this one is not working as expected. But this issue can be fixed "simply" by adding a manual plugin specified here #24844 (comment) in addition to the |
Hi, I am using Expo SDK 49. |
For me, the plugin here is unnecessary because the AndroidManifest that's created seems fine. I have 2 notification_icon additions. |
I have the same issue on IOS. |
PR #28883 has been submitted to fix the Android notification response issues when app is in background or not running. |
Awesome. thank you so much for tracking this down for all of us. Any idea when it will be available? |
Second that! Really need it :) |
0.28.2 didn't fix anything :( |
In my case I can confirm that with the new version, |
@fdelu see the fix that was just added in #28883 , specifically the new method in That is the method that takes the bundle passed into If you are missing part of the payload, you should have a look to see if there are parts of the bundle that are not being mapped by |
@fdelu in looking at this further, it may be that you rebuilt your Android app with the new expo-notifications package, but did not rebuild your JS bundle to pick up the required changes on the JS side: https://github.com/expo/expo/pull/28883/files#diff-37b24aeb2e0d5d7c4365c987c51f03db4b6d20a0927f3eefe0d9e0a35b2c4df7 The |
Yes, that seems like it. I noticed later that I had "dataString" but not "data" so I'm probably missing that. Not sure how that happened though. Thanks for your help! |
After updating to expo-notifications@0.28.2 and building, this works 🎉. Thanks, @douglowder. Great work! 👏 ... the only minor issue is that the notification icon is not displaying correctly with FCM V1. |
An update on this @douglowder: I verified and it is using the latest version. When my app is in the foreground, I get a notificationd and click on it, I see the "response received" log and everything works fine. However, when my app is closed (fully), I get a notification and click on it to open the app, then I don't see that "response received" log, the "data" field is missing and the request content contains the "dataString" field. Looking at the code for Another issue I've been having is that if I get a notification when the app is open, I fully close it and then I reopen the app by clicking the notification, const notification = useLastNotificationResponse();
console.log("LAST RESPONSE", notification);
console.log(
"LAST RESPONSE CONTENT",
notification?.notification?.request?.content
);
console.log(
"LAST RESPONSE TRIGGER",
notification?.notification?.request?.trigger
); The logs:
|
@fdelu yes indeed that is a bug! I think cutting and pasting the new code from NotificationEmitter should fix it... I really appreciate you taking the time to track that down. |
Hi folks, if you're in this thread due to icon-related issues (@deivijt @zandvakiliramin @haplionheart): Can you try using a config plugin like in this comment to ensure the correct fields are in your manifest? And let me know if that changes anything? @krazykriskomar re: your comment here, I wasn't sure if you have it working or not? Can you confirm if icon behavior is correct for you when sending notifs using FCM V1? |
… app in background or killed (#29659) # Why The logic in `onNotificationResponseFromExtras` needs to be adjusted to correctly check whether response listeners are active, and do that check first before falling back to add the response to the pending responses (eventually used by `useLastNotificationResponse()` in JS). See #28656 (comment) # How Inverted the order of checks in the method. # Test Plan - CI should pass - Test the flows with the test app, using both expo-server-sdk tool and expo.dev/notifications web tool # Checklist <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
@codercoder292, please check out my demo repo which applies the last patch needed for this to work https://github.com/mgscreativa/expo-notifications-test |
Just tested expo-notifications@0.28.9 and it works just fine. Updated test repo here https://github.com/mgscreativa/expo-notifications-test useFcmV1=true
|
…e legacy icon and color (#29491) Based on customer feedback from `expo-notifications@0.28.7`, three adjustments are still needed: - Set both FCM legacy and FCMv1 metadata items in the Android manifest, so that icon and color work in both cases - Add a config plugin property, `defaultChannel`, to allow a developer to set the FCMv1 default channel in the manifest. - The Android lifecycle listeners should check to see if the intent extras have a `notificationResponse` object, and not map the intent bundle to create a duplicate response in JS. See [this comment](#28656 (comment)) by @mgscreativa and other comments in that issue. - Make the appropriate code changes in the plugin and in `ExpoNotificationLifecycleListener.java` - CI should pass - Test app patched with these changes should behave as expected <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
… app in background or killed (#29659) The logic in `onNotificationResponseFromExtras` needs to be adjusted to correctly check whether response listeners are active, and do that check first before falling back to add the response to the pending responses (eventually used by `useLastNotificationResponse()` in JS). See #28656 (comment) Inverted the order of checks in the method. - CI should pass - Test the flows with the test app, using both expo-server-sdk tool and expo.dev/notifications web tool <!-- Please check the appropriate items below if they apply to your diff. This is required for changes to Expo modules. --> - [ ] Documentation is up to date to reflect these changes (eg: https://docs.expo.dev and README.md). - [ ] Conforms with the [Documentation Writing Style Guide](https://github.com/expo/expo/blob/main/guides/Expo%20Documentation%20Writing%20Style%20Guide.md) - [ ] This diff will work correctly for `npx expo prebuild` & EAS Build (eg: updated a module plugin).
I am facing the same issue migrating to fcm v1, I found out that the notification that I get from If you want to quickfix it, you can do something like:
|
@codercoder292 and @NoZiL are you doing a fresh build after updating to expo-notifications 0.28.8? The symptoms described (like banner not appearing, missing/unparsed data) all required native code fixes. A few suggestions:
[
"expo-notifications",
{
"icon": "./assets/images/android-notification.png",
"color": "#D84F4F",
"defaultChannel": "default"
}
]
|
expo-notifications is at v0.28.9 at the moment |
I just tested We don't use the expo service to send push notifications, we send them directly to the firebase API using the API V1. The request we send to firebase looks as follows:
Can you see any issue with that request or can you point me to where this is handled in the native code so I can provide more information? |
hi @Codelica @mgscreativa , thanks for your time. All dependencies were up to date, plugin config and a fresh build also, only difference was your 3rd point, I was using Odd thing is the
but the handling of Here are my latest tests results:
FYI: The expo-notifications docs uses the Following are my snippets for testing, used the code from the hook documentation for he hook usage and from the expo docs for usage without hook:
|
Today's updates:
|
@NoZiL to be honest that doesn't really surprise me. Notifications for Android in the killed state have been an issue for a loooong time -- far before |
I've been trying to test FCMV1 after upgrading to the newest push notification version and run into two issues:
|
@jludwiggreenaction thanks for the report. I do have a documentation task ENG-12500 where we will be updating docs to reflect all the recent changes, and what happens with FCMv1 (since that will soon be the only option). We will either adjust the doc for useLastNotificationResponse(), or fix that behavior to match what is documented. |
For SDK 50 developers only, expo-notifications 0.27.8 has just been published, containing all the recent FCMv1 fixes backported to SDK 50. If you are staying with SDK 50, I do recommend that you upgrade to expo 50.0.19 and do SDK 51 developers should use expo-notifications 0.28.9. |
@douglowder thank you for porting down to SDK 50. |
@appsgenie we do not plan to backport these changes to SDK 49. I took a look at doing this, and unfortunately there were a lot of incompatible changes to expo-notifications between SDK 49 and SDK 50, making this backport tricky and higher risk for regressions. |
@douglowder Thanks for the info, however I think that task is not public so I can't see the details. I can adjust for the changes regarding the default channel and return value for now anyway. I narrowed down the other issues I had to being problems with the channel id: The I was opting to not set the new When using the testing tool or using the API myself, the notification is not being sent to the specified channel anyway (it's always going to the default "Miscellaneous" channel). Setting the |
Hi again. Anyone facing notification not displayed(no banner, no vibration, not added to status bar) when unread notification count is over 24+?
when received notification, adb log shows nothing weird compared with unread notification less than 24. notificationHandler |
I am using following packages: "expo": "~51.0.13", I tried testing notification using force fcmv1 in my development build through the expo push notification tool and I am still unable to get the notification data when the app is killed rest all cases are working as before. Hooks being used to test: P.S. I am able to receive notification and their icons properly |
@jludwiggreenaction I was suspicious of this and planned on testing it once I had time -- but you beat me to it. I think the only way to avoid that built-in default "Miscellaneous" channel in the background and killed states is via the new Currently I think the only safe route for things to "work" on Android across all app states in SDK v51 is:
Using other listeners and methods can result in issues currently as @DSp4wN and others have seen, as will not setting |
thank you @Codelica So for channel, if I use multiple channels in my app but also the as for |
Also do you guys know if the |
@Codelica, So I have to make use of useLastNotificationResponse only ? |
@appsgenie Yes, as far as I know your only real option is to pick one for now and set it as
It serves the same basic function as other listeners/methods -- giving you information on the notification that was touched. So it just depends how/if you use that notification data in your app in some way. But currently I think |
@DSp4wN I think that's currently the only reliable way to get all notification information (including custom data) across all app states (foreground, background, killed). At least that's what a couple of us were using during testing here. It's not to say the other listeners and methods won't work work fine in some states, but that hook is the only one I know is safe across the board since that's what I'm using. |
Remember guys that you can check test repo here https://github.com/mgscreativa/expo-notifications-test, it's used by me to test latest modifications/patched by the community and @douglowder |
This is correct. Specifically, you need the We will be adding some text on these issues soon when we update our documentation. |
@douglowder and @Codelica, I am sure you are aware of this (sorry if I am stating the obv) but this killed state notification issue on Android has been there for a long time. I found my solution a while back (I think from #11933). I know that it was solved for me (at least in the older SDK versions) by placing the I am in the middle of upgrading to SDK 51 to see if my existing code as-is still works in killed state so TBD. Currently dealing with |
@appsgenie I think you'll find that previous hack (listener very early in code) no longer works, at least as of v51 and useFcmV1. I was using something similar. But as long as you implement with |
This is a tracking issue for user-reported issues related to the Spring 2024 migration of Expo Push Notifications from FCM Legacy to FCM V1 for Android devices. There have been reported instances of brokenness in production when moving from FCM Legacy to FCM V1, and this issue will serve as a central place to track our investigation and resolution of these issues.
The known issues are as follows:
data
payload in client when receiving push notificationsexpo-notifications@0.28.4
expo-notifications@0.28.5
useLastNotificationResponse()
has null dataHere is a table showing the overall state of these issues, as of 6/11. Package versions are expo@51.0.11 and expo-notifications@0.28.8:
New issues filed in expo/expo will be merged into this tracking issue for easier management. The deadline for migrating to FCM V1 is June 20.
The text was updated successfully, but these errors were encountered: