繁体   English   中英

React Native Push Notifications 在 Android 中不工作,但在 iOS 上工作正常

[英]React Native Push Notifications not working in Android but works fine on iOS

我最近在我的 React Native 应用程序中设置了推送通知,它在 iOs 中运行良好,但在 Android 中无法弹出。 这是我正在调用以触发通知的 function。 推送功能

这是我在上面配置推送通知的地方

配置推送功能

正如我所说,它在 iOS 上运行良好,当我删除 channelId(我知道这是 android 所必需的)时,我收到了这条消息......这让我相信它正在以某种方式配置但不完全。 电话警告

以下是我的配置文件的 rest 在此之后: https://github.com/zo0r/react-native-push-notification

第一个配置

第二个配置

第三个配置

对此的任何第二意见都会很棒。 谢谢你。

我想你忘了创建香奈儿,你可以试试这个:

 function pushNotif(){ PushNotification.createChannel( { channelId: "specialid", // (required) channelName: "Special messasge", // (required) channelDescription: "Notification for special message", // (optional) default: undefined. importance: 4, // (optional) default: 4. Int value of the Android notification importance vibrate: true, // (optional) default: true. Creates the default vibration patten if true. }, (created) => console.log(`createChannel returned '${created}'`) // (optional) callback returns whether the channel was created, false means it already existed. ); PushNotification.localNotification({ channelId:'specialid', //his must be same with channelid in createchannel title:'hello', message:'test message' }) }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM