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

非常感謝您節省我的一天 –

相關問題