首页 > 解决方案 > 点击 ExoPlayer 通知打开应用

问题描述

使用 ExoPlayer 和 PlayerNotificationManager 在通知中显示媒体播放进度,现在如何通过单击通知打开应用程序?

标签: exoplayer

解决方案


当您尝试通过 PlayerNotificationManager 创建NotificationChannel 时,您直接在 MediaDescriptor 下覆盖此方法

@Override

 public PendingIntent createCurrentContentIntent(Player player){
     Intent intent = new Intent(YourService.this,YourMediaActivity.class);
                       PendingIntent contentPendingIntent = PendingIntent.getActivity
                                (YourService.this, 0, intent, 0);
                        return contentPendingIntent;
                    }

推荐阅读