Моя проблема в том, что если я запускаю свое приложение на устройстве Huawei, я не могу получить никакого уведомления, но если я запускаю свое приложение на другом устройстве, оно работает нормально, и вы найдете ниже код уведомления в моем FirebaseMessagingService
:
private void displayNotification(RemoteMessage.Notification notification, Map<String, String> data) {
Random generator = new Random();
String id = data.get("element");
String type = data.get("type");
Intent intent;
intent = new Intent(this, Home.class);
intent.putExtra("retour", type + "test");
intent.putExtra("element_id", id);
intent.setAction(Long.toString(System.currentTimeMillis()));
Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);//RingtoneManager.TYPE_NOTIFICATION
long[] pattern = {500, 500, 500, 500, 500, 500, 500, 500, 500};
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
NotificationCompat.Builder notificationbuilder = new NotificationCompat.Builder(this);
notificationbuilder.setContentTitle(notification.getTitle());
notificationbuilder.setContentText(notification.getBody());
notificationbuilder.setAutoCancel(true);
notificationbuilder.setVibrate(pattern);
notificationbuilder.setSound(defaultSoundUri);
notificationbuilder.setSmallIcon(R.drawable.icoapp_and);
notificationbuilder.setColor(getResources().getColor(R.color.colorAccent));
notificationbuilder.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(generator.nextInt(), notificationbuilder.build()); }