I understand you're using VXG Media Player for your application. VXG Media Player is a third-party library for video playback in Android. Let's adapt the previous implementation to work with VXG Media Player. Here's a basic implementation that integrates VXG Media Player with a media notification: First, make sure you have the VXG Media Player SDK integrated into your project according to their documentation. Here's a modified version of the code that should work with VXG Media Player: kotlinCopyimport android.app.* import android.content.Intent import android.os.Build import android.os.Bundle import androidx.core.app.NotificationCompat import androidx.media.app.NotificationCompat.MediaStyle import com.vxg.mediaplayer.VXGMediaPlayer class MediaPlaybackService : Service() { private lateinit var mediaPlayer: VXGMediaPlayer private var isPlaying = false override fun onCreate() { super.onCreate() mediaPlayer = VXGMediaPlayer(this) createNotificationChannel() } override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { when (intent?.action) { "PLAY" -> playMedia() "PAUSE" -> pauseMedia() "STOP" -> stopMedia() } return START_STICKY } private fun playMedia() { mediaPlayer.open("YOUR_STREAM_URL_HERE") mediaPlayer.start() isPlaying = true showNotification() } private fun pauseMedia() { mediaPlayer.pause() isPlaying = false showNotification() } private fun stopMedia() { mediaPlayer.stop() isPlaying = false stopForeground(true) stopSelf() } private fun showNotification() { val playPauseIntent = Intent(this, MediaPlaybackService::class.java).apply { action = if (isPlaying) "PAUSE" else "PLAY" } val playPausePendingIntent = PendingIntent.getService(this, 0, playPauseIntent, PendingIntent.FLAG_UPDATE_CURRENT) val stopIntent = Intent(this, MediaPlaybackService::class.java).apply { action = "STOP" } val stopPendingIntent = PendingIntent.getService(this, 0, stopIntent, PendingIntent.FLAG_UPDATE_CURRENT) val builder = NotificationCompat.Builder(this, "media_playback_channel") .setSmallIcon(R.drawable.ic_notification) .setContentTitle("VXG Media Player") .setContentText("Now playing") .setPriority(NotificationCompat.PRIORITY_DEFAULT) .setVisibility(NotificationCompat.VISIBILITY_PUBLIC) builder.addAction( if (isPlaying) NotificationCompat.Action(R.drawable.ic_pause, "Pause", playPausePendingIntent) else NotificationCompat.Action(R.drawable.ic_play, "Play", playPausePendingIntent) ) builder.addAction(NotificationCompat.Action(R.drawable.ic_stop, "Stop", stopPendingIntent)) builder.setStyle(MediaStyle() .setShowActionsInCompactView(0, 1)) startForeground(1, builder.build()) } private fun createNotificationChannel() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val serviceChannel = NotificationChannel( "media_playback_channel", "Media Playback", NotificationManager.IMPORTANCE_DEFAULT ) val manager = getSystemService(NotificationManager::class.java) manager.createNotificationChannel(serviceChannel) } } override fun onBind(intent: Intent?) = null override fun onDestroy() { super.onDestroy() mediaPlayer.close() } }