service를 사용해서 음악을 백그라운드로 재생했는데요.
쓰레드를 하나 생성했구요. 여기서 미디어 플레이어를 재생시켰습니다.
startService(new Intent("package.name));
이렇게 서비스를 시작하여
서비스 클래스에서 쓰레드를 시작하고
@Override
public void onStart(Intent intent, int startId) {
Log.d("slog", "onStart()");
super.onStart(intent, startId);
try
{
if(play_thread == null)
{
play_thread = new Thread(m_run_play);
}
play_thread.start();
}catch(Exception e)
{
e.printStackTrace();
}
}
아래와 같이 재생합니다.
// sound play
public Runnable m_run_play = new Runnable() {
public void run(){
try
{
if(mcApp.kickout_player == null)
{
player = MediaPlayer.create(getApplicationContext(), Uri.parse(player_Path));
player.setLooping(true);
}
player.start();
}catch(Exception e)
{
e.printStackTrace();
}
}
};
암튼 이렇게 재생했음에도 불구하고
재생하다 보니
01-15 16:43:26.139: D/dalvikvm(16917): GC_CONCURRENT freed 409K, 8% free 12418K/13447K, paused 7ms+3ms, total 48ms
위와 같이 메모리가 8%밖에 안남았다는 로그가 날라오는데...
원래 이렇게 메모리 소모가 심한것인지..
아님 제가 잘못하고 있는 것인지.. 조언 부탁드립니다.