마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

RingtoneManager 효과음, Notification.vibrate 동시 사용시 효과음이 이상해져요

0 추천
알람어플을 제작 하고있습니다. BroadcastReceiver를 통해 정해진 시간이 되면 상태바에 메세지를 띄우고, Notification.vibrate를 사용하여 진동 + RingtoneManager 효과음을 주었습니다. 근데 소리가 나긴 하는데 원음으로 나오지 않고 소리에 버퍼링이 걸린것 처럼 음이 깨져서 나옵니다 어떻게 해야할까요 고수님들 조언 부탁드려요.

소스는 아래와 같습니다.

onReceive(Context context, Intent intent) {

NotificationManager notifier = (NotificationManager) context
                    .getSystemService(Context.NOTIFICATION_SERVICE);

            Notification no = new Notification(R.drawable.ex_mi, "알람    알람나오기",
                    System.currentTimeMillis());
            no.number = 0;

            Intent intent2 = new Intent(context, analysis
                    .class);
            PendingIntent pender = PendingIntent
                    .getActivity(context, 0, intent2, PendingIntent.FLAG_UPDATE_CURRENT);

            no.setLatestEventInfo(context, "알람", "알람상태바", pender);

            no.flags |= Notification.FLAG_AUTO_CANCEL;
            no.vibrate = new long[] {200, 200};

            notifier.notify(1, no);
            //no.sound=notification;
            
            
            Uri uri= RingtoneManager.getDefaultUri(RingtoneManager.ID_COLUMN_INDEX);
            Ringtone ring = RingtoneManager.getRingtone(context, uri);
            ring .play();

}
androidddd (520 포인트) 님이 2015년 12월 10일 질문

1개의 답변

0 추천
노티 옵션에 따라 소리도 나고 진동도 나고..그런것 때문에 충돌이 나는것 같네요.

노티쪽을 무음/무진동으로 처리하고 진동을 따로 발생시키거나

소리를 나중에 발생시키도록 해보세요.(이건 안좋은 방법..)
라쎄린드 (25,460 포인트) 님이 2015년 12월 11일 답변
no.vibrate = new long[] {200, 200}; 이 부분을 주석처리해도 음이 깨지는데 어떻게 해야 하나요. ㅠㅜ 무슨문제인지 알수가 없네요
...