wix / react-native-notifications

React Native Notifications
MIT License
3.25k stars 764 forks source link

android device does not show push notification #897

Closed camboYY closed 1 year ago

camboYY commented 2 years ago
minSdkVersion = 21
compileSdkVersion = 33
targetSdkVersion = 33

System: OS: macOS 12.5.1 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 391.32 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 14.17.4 - /usr/local/bin/node Yarn: 1.22.11 - /usr/local/bin/yarn npm: 7.20.3 - /usr/local/bin/npm Watchman: 2021.08.02.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 15.4, macOS 12.3, tvOS 15.4, watchOS 8.5 Android SDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7583922 Xcode: 13.3/13E113 - /usr/bin/xcodebuild Languages: Java: 11.0.12 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.4 => 0.63.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

egadstar commented 2 years ago

Likely cause Android 13 requires user approval for push notifications.

camboYY commented 2 years ago

hi @egadstar i have allowed permission but still not work

ranjankhanna commented 2 years ago

I am also having the same issue with remote notification. I am able to receive the notification but it does not show up(also the sound does not play)

mark-zacharias commented 1 year ago

If the app is backgrounded the remote notifications are showing for me. However if the app is in the foreground no notification is displayed. If I register an event handler via the registerNotificationReceivedForeground method i can see the notification is received but nothing is shown.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 1 year ago

The issue has been closed for inactivity.

gavrichards commented 1 year ago

Still an issue, not stale.

Swapnileclat commented 1 year ago

Same issue

jakubkoci commented 1 year ago

I'm experiencing the same issue. The notifications were received, but no icon or notification was in the system notification center.

jakubkoci commented 1 year ago

Now, it works for me. I think, that the reason might be wrong data format of the notification. I'm sending it via Amazon SNS, the payload needs to be in this format:

{
  "GCM": "{ \"data\": { \"message\": \"Sample message for Android endpoints\", \"title\": \"New Message\", \"body\": \"You have a new message\" } }"
}

The important attributes are title and body. I tried it also with curl and the following command works:

curl -X POST \
  https://fcm.googleapis.com/fcm/send \
  -H 'Authorization: key=SERVER_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Host: fcm.googleapis.com' \
  -d '{
 "to" : "DEVICE_TOKEN",
 "data" : {
     "body" : "Body of Your Notification in Data",
     "title": "Title of Your Notification in Title",
     "key_1" : "Value 1",
     "key_2" : "Value 1"
 }
}'
SwhiteMHC commented 1 year ago

I am experiencing the same issue. The above suggestion from jakubkoci does not work. I am using Amazon SNS to send the notification. I do receive the notification and log its values in the .registerNotificationReceivedForeground() method.

buildToolsVersion = "33.0.0" minSdkVersion = 21 compileSdkVersion = 33 targetSdkVersion = 33 ndkVersion = "23.1.7779620"

Device: Samsung Galaxy A14 5G