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

특정때 벨소리 및 진동으로 알려주고 싶은데 어떻게 구현해야하나요??

–1 추천
벨소리 및 진동 출력하고 싶은데

어떻게 구현해야하나요??
쿠쿠부다스 (6,470 포인트) 님이 2016년 7월 26일 질문

1개의 답변

0 추천
Notification을 같이 사용하여 구현한다면 쉽게 구현할 수 있습니다.

NotificationCompat.Builder builder = new NotificationCompat.Builder(context);

.

.

builder.setVibrate(new long[]{1000, 1000, 1000, 1000}); //진동

builder.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);

.

.

notificationManager.notify(인덱스, builder.build());

 

notification 관련된 정보는 아래의 레퍼런스 사이트 가이드를 참조하세요.

https://developer.android.com/guide/topics/ui/notifiers/notifications.html
Development Guy (70,570 포인트) 님이 2016년 7월 26일 답변
...