小编Yun*_*LIU的帖子

媒体会话在 AOD 上有“无标题”(始终显示)

在我的应用程序中,我显示了一个带有前台服务的通知,该服务负责播放音乐。通知由 com.google.android.exoplayer2.ui.PlayerNotificationManager android.support.v4.media.session.MediaSessionCompat com.google.android.exoplayer2.ext.mediasession.MediaSessionConnector

    mediaSession = MediaSessionCompat(this, "Player", null, null)
    mediaSession.isActive = true
    mediaSessionConnector = MediaSessionConnector(mediaSession)
    mediaSessionConnector.setPlayer(exoPlayer)
    playerNotificationManager = PlayerNotificationManager.createWithNotificationChannel(
            this,
            "notification_channel_player",
            R.string.notification_channel_name_player,
            0,
            PLAYER_NOTIFICATION_ID,
            object : PlayerNotificationManager.MediaDescriptionAdapter {
                override fun createCurrentContentIntent(player: Player?): PendingIntent? {
                    // intent
                }

                override fun getCurrentLargeIcon(player: Player?, callback: PlayerNotificationManager.BitmapCallback?): Bitmap? {
                    // large icon
                }

                override fun getCurrentContentText(player: Player?): String? {
                    // artist
                }

                override fun getCurrentContentTitle(player: Player?): String {
                    // title
                }

            },
            object : NotificationListener {
                override fun onNotificationPosted(notificationId: Int, notification: Notification?, ongoing: …
Run Code Online (Sandbox Code Playgroud)

notifications android lockscreen exoplayer

7
推荐指数
1
解决办法
1041
查看次数

标签 统计

android ×1

exoplayer ×1

lockscreen ×1

notifications ×1