Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- builder.setStyle(new androidx.media.app.NotificationCompat.MediaStyle());
- NotificationCompat.Builder builder = new NotificationCompat.Builder(service, PRIMARY_CHANNEL)
- .setAutoCancel(false)
- .setContentTitle(strAppName)
- .setContentText(strLiveBroadcast)
- .setLargeIcon(largeIcon)
- .setContentIntent(pendingIntent)
- .setVisibility(NotificationCompat.VISIBILITY_PUBLIC)
- .setSmallIcon(R.drawable.ic_launcher)
- .addAction(icon, "pause", action)
- .addAction(R.drawable.exo_notification_stop, "stop", stopAction)
- .setPriority(NotificationCompat.PRIORITY_HIGH)
- .setWhen(System.currentTimeMillis())
- // .setStyle(new android.support.v4.media.app.NotificationCompat.MediaStyle() // lawas
- .setStyle(new androidx.media.app.NotificationCompat.MediaStyle()
- .setMediaSession(service.getMediaSession().getSessionToken())
- .setShowActionsInCompactView(0, 1)
- .setShowCancelButton(true)
- .setCancelButtonIntent(stopAction));
- service.startForeground(NOTIFICATION_ID, builder.build());
- ////////////////////
- ////##############
- <receiver android:name="androidx.media.session.MediaButtonReceiver">
- <intent-filter>
- <action android:name="android.intent.action.MEDIA_BUTTON"/>
- </intent-filter>
- </receiver>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement