안드로이드 개발 질문/답변
(글 수 45,052)
질문이 뭐냐면요 제가 매 정시마다 그 시간에 맞게 알람을 울리면 방송에서 서비스를 호출하게 해주고있습니다
알람은 잘 울리는데여 문제는 알람이 울리고 나서 이런 오류가 뜹니다 03-04 04:11:36.534: WARN/AudioFlinger(34): write blocked for 74 msecs, 921 delayed writes, thread 0xb3f0
public class Sound{
Context con;
SoundPool soundPool = null;
int sound[] = null;
public Sound(Context con){
soundPool = new SoundPool(1, AudioManager.STREAM_MUSIC, 0 );
sound = new int[12];
sound[0] = soundPool.load(con, R.raw.h12, 1);
sound[1] = soundPool.load(con, R.raw.h1, 1);
sound[2] = soundPool.load(con, R.raw.h2, 1);
sound[3] = soundPool.load(con, R.raw.h3, 1);
sound[4] = soundPool.load(con, R.raw.h4, 1);
sound[5] = soundPool.load(con, R.raw.h5, 1);
sound[6] = soundPool.load(con, R.raw.h6, 1);
sound[7] = soundPool.load(con, R.raw.h7, 1);
sound[8] = soundPool.load(con, R.raw.h8, 1);
sound[9] = soundPool.load(con, R.raw.h9, 1);
sound[10] = soundPool.load(con, R.raw.h10, 1);
sound[11] = soundPool.load(con, R.raw.h11, 1);
}
public void start(){
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(System.currentTimeMillis());
int i =cal.get(Calendar.HOUR_OF_DAY);
soundPool.play( sound[i], 1, 1, 0, 0, 1);
}
}
public class AlarmService extends Service {
Sound sound = null;
public void onCreate(){
super.onCreate();
sound = new Sound(this);
}
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
public void onDestroy(){
super.onDestroy();
}
public int onStartCommand(Intent intent,int flags ,int StartId){
if (intent == null) {
return START_NOT_STICKY;
}
super.onStartCommand(intent, flags, StartId);
sound.start();
return START_STICKY;
}
}



