안드로이드 개발 질문/답변
(글 수 45,052)
안드로이드 Notification Bar에 알림을 넣었습니다.
백그라운드 서비스가 돌다가 서버에서 응답이 오면 아래의 알림을 보여주는건데요...
작동은 잘 하는데 소리와 진동관련해서 문의 드립니다.
아래 소스와 같이
noti.defaults |= Notification.DEFAULT_SOUND;
noti.defaults |= Notification.DEFAULT_VIBRATE;
소리와 진동을 디폴트로 했더니 소리는 딩동,딩동,딩동,딩동,.... 이렇게 계속 소리가 나고
진동은 삐~,삐~,삐~,삐~,... 이렇게 계속 진동이 울립니다...
소리와 진동을 한번씩만 내게하고 싶은데요.
카톡은 화면꺼진 상태에서 메세지가 오면 딩동 소리한번에 삐~ 진동한번 이렇게 오더라구요....
어떻게 하면 좋을지 좀 알려주세요...
자료를 찾아보다 못찾아서 이렇게 글 남겨봅니다....
mNotiManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
final Notification noti = new Notification(R.drawable.icon,getString(R.string.app_name),System.currentTimeMillis()); noti.defaults |= Notification.DEFAULT_SOUND;
noti.defaults |= Notification.DEFAULT_VIBRATE;
noti.flags |= Notification.FLAG_INSISTENT;
PendingIntent content = PendingIntent.getActivity(mContext, 0, it, PendingIntent.FLAG_UPDATE_CURRENT);
noti.setLatestEventInfo(mContext, 알리미, content);
mNotiManager.notify(PlannerAlarmNoti.NAPNOTI, noti);
그럼 수고하세요.... ^^




혹시 호출이 여러번 되는지 확인 해 보시는게..