首页 > 解决方案 > 在某些设备上无法接收 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);
}

谢谢!

标签: androidfirebasefirebase-cloud-messaging

解决方案


推荐阅读