Kawsar
Kawsar

Reputation: 127

Exoplayer notification is not showing on real device but showing in emulator well

I am using exoplayer latest api
'com.google.android.exoplayer:exoplayer:2.14.0'

and my code to show with PlayerNotificationManager.Builder are

 PlayerNotificationManager notiBuilder = new PlayerNotificationManager.Builder(getApplicationContext()
    ,NOTI_ID,CHANNEL_ID,new MediaDescripTo()).build();
    notiBuilder.setControlDispatcher(new DispatcherDef());

    notiBuilder.setUseNextAction(false);
    notiBuilder.setUsePreviousAction(false);
    notiBuilder.setPlayer(exoPlayer);

I am not getting any error from Log cat NB: I am a newbie and didn't find any solution for this.Thanks in advance

Upvotes: 0

Views: 703

Answers (1)

Kawsar
Kawsar

Reputation: 127

PlayerNotificationManager.Builder myNoti = new PlayerNotificationManager.Builder(getApplicationContext()
                , NOTI_ID, CHANNEL_ID, new MediaDescripTo());
        myNoti.setNotificationListener(new NotiListener());
        myNoti.setChannelImportance(NotificationUtil.IMPORTANCE_LOW);
        myNoti.setChannelNameResourceId(R.string.noti_name);

        notiBuilder = myNoti.build();
        notiBuilder.setControlDispatcher(new DispatcherDef());
        notiBuilder.setUseNextAction(true);
        notiBuilder.setUsePreviousAction(true);
        notiBuilder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC);
        notiBuilder.setPlayer(exoPlayer);

I made two instance first for PlayerNotificationManager.Builder and second for only PlayerNotificationManager then I set the Channel Id for the the notification builder then its show also in real device . Thank you

Upvotes: 1

Related Questions