package com.cooleshow.base.service;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

import com.cooleshow.base.constanst.Constants;


public class PlayMusicReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (action.equals(Intent.ACTION_HEADSET_PLUG)) {
            if (intent.hasExtra("state")) {
                if (intent.getIntExtra("state", 0) == 0) {
                    //无耳机插入
                    Constants.HEADSET_PLUE_TAG = "";
                } else if (intent.getIntExtra("state", 0) == 1) {
                    //有耳机插入
                    Constants.HEADSET_PLUE_TAG = "有线耳机";
                }
            }
        }
    }
}
