package com.xty.common.broadCast

import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import com.xty.common.services.MusicService

class MusicBroadCast : BroadcastReceiver() {
    override fun onReceive(context: Context, intent: Intent?) {
        intent?.let {
            val action = it.action
            var intent = Intent(context, MusicService::class.java)
            when (action) {
                "music_broad" -> {
                    //通知被清楚了
                    intent.putExtra("close", "")
                    context.startService(intent)
                }
                "music_broad_play" -> {
                    //播放状态
                    intent.putExtra("play", "play")
                    context.startService(intent)
                }
                else -> {

                }
            }

        }

    }
}