android - 在某些设备上无法接收 FCM
问题描述
几天前,我尝试使用 FCM 开发一个具有一些简单功能的应用程序。在我尝试在 Pixel 4 API 28 上测试我的应用程序之前,一切似乎都很好。我有 NotificationChanel,所以我得到了令牌。但是当我发送消息时,设备无法接收。奇怪的事情,因为它在 Pixel 3a 上运行良好。
那么,有人知道答案吗?
通知频道
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
String channelId = "Channel_id";
CharSequence name = getString(R.string.channel_name);
String description = getString(R.string.channel_description);
int importance = NotificationManager.IMPORTANCE_HIGH;
NotificationChannel channel = new NotificationChannel(channelId, name, importance);
channel.setDescription(description);
channel.enableVibration(true);
NotificationManager notificationManager = getSystemService(NotificationManager.class);
notificationManager.createNotificationChannel(channel);
}
谢谢!
解决方案
推荐阅读
- sql - 获取有关在 Oracle 中导致“ORA-00001 违反唯一约束”错误的源行的信息
- php - 从array_chunk返回结果中获取第n个元素
- python - 谷歌云数据存储 API 上的参数太少错误
- html - Angular - 无法绑定到 href
- angular - 如何在 Angular 6 中使用模板选择?
- python - pandas:将数据框列拆分为单独的行
- solr - 在单个文档中具有多个实体的 Solr 搜索查询
- batch-file - 批处理脚本参数中带空格的引号参数
- python - 如何通过模仿 Python 中的 reduce 函数来找到列表中的最大整数?
- html - *仅限 IE6*:没有滚动条可向下推页脚... 相对父级 > 绝对子级 > 相对子级