3

我正在实施FCM来推送通知,但我试图在通知内容很大时扩展通知。
当应用程序在后台当应用程序在后台时,我的FCM通知不会扩展

这里是我的代码

PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); 
    Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); 

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) 
      .setSmallIcon(R.drawable.ic_stat_new_logo).setTicker(title).setWhen(0) 
      .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.drawable.ic_stat_new_logo)) 
      .setContentTitle("SuezApp") 
      .setContentText(remoteMessage.getNotification().getBody()) 
      .setAutoCancel(true) 
      .setStyle(new NotificationCompat.BigTextStyle().bigText(title)) 
      .setStyle(new NotificationCompat.BigTextStyle().bigText(remoteMessage.getNotification().getBody())) 
      .setPriority(Notification.PRIORITY_MAX) 
      .setSound(defaultSoundUri) 
      .setContentIntent(pendingIntent); 
    final NotificationCompat.BigTextStyle style = new NotificationCompat.BigTextStyle(notificationBuilder); 
    NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
    notificationManager.notify(0, notificationBuilder.build()); 

我如何展开时,应用程序在后台,不能执行?

回答

0

Firebase 9.4 release notes:现在

扩展手势支持消息,从而允许在Android UI时的通知的主体超过单个线来显示多行。

确保您使用Firebase 9.4或更高版本作为您的依赖项。

+0

非常感谢您节省我的一天 –

相关问题