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

notify sound 지정시 반복하지 않고 한번만 플레이하고 싶습니다.

0 추천
Uri uri = intent.getData();
Intent intent2 = new Intent(context, MainActivity.class);
String myjo = intent.getStringExtra("jonum");		
PendingIntent pender = PendingIntent.getActivity(context, 0, intent2, PendingIntent.FLAG_UPDATE_CURRENT);
notify.setLatestEventInfo(context, "시작",myjo , pender);
notify.flags |= Notification.FLAG_AUTO_CANCEL;
notify.vibrate = new long[] { 900, 200, 500, 200 ,200 ,500 ,600};
if(uri!=null||uri.toString().length()>0){
       notify.sound = uri;
}else{
       notify.sound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
}
notify.number++;
notifier.notify(1, notify);

 

메인 엑티비티에서 알람음을 선택하면 선택한 알람음Uri를 보내서 사운드를 내고

아니면 기본알람음을 내도록 만들었습니다.

 

기본알람음은 한번 울리고 끝나는데

알람음을 선택하면  상태창을 키기전까지 반복해서 알람 소리가 나오고 있습니다. (__);

 

데칼챠 (210 포인트) 님이 2014년 2월 19일 질문

2개의 답변

+1 추천
 
채택된 답변

http://blog.naver.com/snewworld?Redirect=Log&logNo=60190279748 참고하세요

 

Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

 

// 알람 타입만 호출

intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_ALARM);
 

// 알림음 타입 호출

intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION);
 

// 벨소리 타입 호출

intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_RINGTONE);
  
  
startActivity(intent); // 인텐트 실행.

 

인텐트 실행 전에 어떤 타입을 표시할건지 세팅해주시면 될 것 같네요 ~

초보개발자ㅠ (33,870 포인트) 님이 2014년 2월 19일 답변
데칼챠님이 2014년 2월 19일 채택됨
감사합니다. 해결되었습니다.
 너무 기분 좋습니다. ^^
도움이 되셨다니 저도 기쁘네요 ^^
0 추천
자답입니다만

알람음 선택에서

링톤픽커로  가져와서 노티사운드가 아닌 전화벨소리로 알람음이 설정되있었습니다.

Intent i = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);

 

이어서 질문입니다

링톤픽커 처럼 알람음 리스트가 뜨는 상수는 없을까요?
데칼챠 (210 포인트) 님이 2014년 2월 19일 답변
...