안드로이드 개발 질문/답변
(글 수 45,052)
카카오톡처럼 새로운 메세지가 도착하면
private void showNotify()
{
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
int _ID = 0xffff0001;
Notification notification = null;
notification = new Notification(R.drawable.icon, "start notify", System.currentTimeMillis());
notification.vibrate = new long[]{1000, 1000, 200, 200};
notification.defaults |= Notification.DEFAULT_VIBRATE; <===============이부분
notification.flags = Notification.FLAG_AUTO_CANCEL;
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, NotityMessage.class), 0);
notification.setLatestEventInfo(this, "Test Notify", "hello notification", contentIntent);
nm.notify(_ID, notification);
}
이 함수를 호출하게 되는데요
DEFAULT_VIBRATE
만 호출하면 죽습니다 ㅠ_ㅠ
제 기종은 옵티머스큐이고요 혹시 이 문제를 겪어 보신분 계신가요
Q&A에는 전혀 없더라구요 ㅠ
2011.05.13 15:24:03
저도 비슷한걸 하고 있는데 이상하게 nm.notify()만 하면 디버깅 할 때 source not found 가 나옵니다.
꼭 조언 부탁드립니다...
public void SetMyNotification(){
NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
int _ID = 0xffff0001;
Notification notification = null;
notification = new Notification(R.drawable.icon, "start notify", System.currentTimeMillis());
notification.vibrate = new long[]{1000, 1000, 200, 200};
notification.defaults |= Notification.DEFAULT_VIBRATE;
notification.flags = Notification.FLAG_AUTO_CANCEL;
nm.notify(_ID, notification);
}




퍼미션없이 해서 그렇네요^^
DEFAULT_VIBRATE을 사용하기 위해 android.permission.VIBRATE