获取系统当前正在播放的音频进程

public List getAllPidInPlayList() {
        ArrayList list = new ArrayList<>();
        String pid = AudioSystem.getParameters("Active_Music_pid");
        if (pid == null || pid.length() <= 0)
            return list;
        String pidArray[] = pid.split(",");
        for(int i = 0; i < pidArray.length; i++) {
            if (pidArray[i] == null || pidArray[i].length() <= 0) {
                break;
            }
            Slog.w(TAG, "pid = "  + pidArray[i]);
            list.add(pidArray[i]);
        }
        return list;
    }

 

你可能感兴趣的:(Android,App)