是否可以在Flutter中自定义Firebase Cloud Notification?

时间:2019-12-11 11:29:48

标签: android flutter push-notification firebase-cloud-messaging

在android中,通知的一项重要功能是自定义其主体内容并添加其他控件。

Notification notification = new NotificationCompat.Builder(context, CHANNEL_ID)
// Show controls on lock screen even when user hides sensitive content.
    .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
    .setSmallIcon(R.drawable.ic_stat_player)
    // Add media control buttons that invoke intents in your media service
    .addAction(R.drawable.ic_prev, "Previous", prevPendingIntent) // #0
    .addAction(R.drawable.ic_pause, "Pause", pausePendingIntent)  // #1
    .addAction(R.drawable.ic_next, "Next", nextPendingIntent)     // #2
    // Apply the media style template
    .setStyle(new android.support.v4.media.app.Notification.MediaStyle()
    .setShowActionsInCompactView(1 /* #1: pause button */)
     .setMediaSession(mediaSession.getSessionToken()))
     .setContentTitle("Wonderful music")
     .setContentText("My Awesome Band")
     .setLargeIcon(albumArtBitmap)
     .build();

可以使用firebase_messaging插件实现此功能吗?

0 个答案:

没有答案