DMAudioStreamer icon indicating copy to clipboard operation
DMAudioStreamer copied to clipboard

Notification media controls not working in 8.0+

Open SiddharthRana opened this issue 7 years ago • 5 comments

The play/pause and backward/forward buttons are not working in android 8.0+. However click on the whole notification layout is playing/pausing the song. Please resolve it.

SiddharthRana avatar Feb 21 '18 05:02 SiddharthRana

In Android O 8.0+ android introduce lots of new API for notification. We need to update our notification manager class for that. I'm working on it, probably will provide some update very soon. For more details check below link. https://developer.android.com/guide/topics/ui/notifiers/notifications.html#ManageChannels

Please find my latest release compile 'com.github.dibakarece:dmaudiostreamer:v1.0.4' . Please set your targetSDKVerison to 25 it can resolve your issue. Still I'm working on it once I'm complete my solution will update you. Thanks in advance.

Already Tag this issue before https://github.com/dibakarece/DMAudioStreamer/issues/2

dibakarece avatar Feb 21 '18 16:02 dibakarece

I solve this issue by change:

PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, new Intent(NOTIFY_PREVIOUS), PendingIntent.FLAG_UPDATE_CURRENT);

to

Intent intentAction = new Intent(NOTIFY_PREVIOUS); intentAction.setClass(getApplicationContext(), AudioStreamingReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(getApplicationContext(), 0, intentAction, PendingIntent.FLAG_UPDATE_CURRENT);

Make it explicit using the setClass method.

I use targetSDKVerison 27 and works fine.

And don't forget to create notification channel.

yzzzd avatar Jul 30 '18 06:07 yzzzd

Thanks @yzzzd :) 👍

dibakarece avatar Aug 03 '18 19:08 dibakarece

@yzzzd , could you please elaborate what to do? NOTIFY_PREVIOUS has no definition, and how to add a created NotificationChannel so that API 27+ Devices don't crash?

dhairav avatar Aug 12 '18 10:08 dhairav

Latest version has been released now. Please test with latest version and let me know if any issue. -> implementation 'com.github.dibakarece:DMAudioStreamer:v1.0.5'

dibakarece avatar Dec 26 '18 18:12 dibakarece