Closed khelifioussama closed 2 years ago
you need to follow the payload format specified in https://docs.expo.dev/push-notifications/sending-notifications-custom/#fcm-server
as Payload I am using this :
const message = {
data: {
title: ${title}
,
message: ${body}
,
// ⚠️ Notice the schema of this payload is different
// than that of Firebase SDK. What is there called "body"
// here is a "message". For more info see:
// https://docs.expo.dev/versions/latest/sdk/notifications/#android-push-notification-payload-specification
// ⚠️ As per Android payload format specified above, the
body: JSON.stringify(data.payload), // additional "data" should be placed under "body" key.
},
}; with firebase-admin :
admin .messaging() .sendToDevice(pushToken, message, notification_options) .then((response) => { }) .catch((error) => { });
you need to provide the experienceId as referenced in https://docs.expo.dev/push-notifications/sending-notifications-custom/#fcm-server
@brentvatne I have the same issue until now I am using expo notification as listener I try to send notification throw PostMan with Body : { "to" : MYKEY", "priority": "normal", "data": { "experienceId": "MY EXPERIENCE ID", "title": "Hello", "message": "Test Message" } } and with Header contain : Content-Type : application/json and Authorization : key= MYKEY and I got always the same error : E/expo-notifications: No scope key found in notification
The message format you need to send to FCM appears to have changed after this PR: https://github.com/expo/expo/pull/12964/files#diff-5baa817040e79cc34458002f16536c38b1836bf3baf3b541b72b0b96beaee011R48 (Expo 43 I think)
experienceId
-> scopeKey
It's not clear to me that this was deliberate.
@randomjunk thank you for this information. I can now send Android notifications to apps built with Expo 43+
Sorry for the thrash. The change from experienceId
to scopeKey
was deliberate, and I forgot to update this documentation. Will make the update now.
Summary
FCM notification are not shown in device ,
Managed or bare workflow? If you have made manual changes inside of the
ios/
orandroid/
directories in your project, the answer is bare!managed
What platform(s) does this occur on?
Android
Package versions
No response
Environment
Expo CLI 4.13.0 environment info: System: OS: Windows 10 10.0.19042 Binaries: Node: 14.17.1 - C:\Program Files\nodejs\node.EXE Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD npm: 6.14.13 - C:\Program Files\nodejs\npm.CMD IDEs: Android Studio: Version 2020.3.0.0 AI-203.7717.56.2031.7784292 npmPackages: @expo/webpack-config: ^0.16.2 => 0.16.7 expo: ^43.0.0 => 43.0.2 react: 17.0.1 => 17.0.1 react-dom: 17.0.1 => 17.0.1 react-native: 0.64.3 => 0.64.3 react-native-web: 0.17.1 => 0.17.1 Expo Workflow: managed
Reproducible demo or steps to reproduce from a blank project
Working with FCM notification server side and expo-notification device side , I did use expo-notification documentation but no notification sent to device , so I used android studio to debug the APK and I have this message for every received notification : E/expo-notifications: No scope key found in notification . any solution Please
Stacktrace (if a crash is involved)
No response