본문 바로가기

Android

multi notification 보낼 시 참고

반응형

카카오톡처럼 notification을 여러 개로 보내야 하는 작업을 했습니다.


여러 개로 나누는 방법은




notificationManager.notify(Integer.valueOf(phoneNumber) /* ID of notification */, notificationBuilder.build());




이겁니다. 즉, notify 할 때 해당 노티마다 "구분"을 해주기 위한 "값"을 넣어줍니다. 그러면 여러 개의 노티가 똭!!!




그리고 해당 노티마다 "다른" 작동을 하기 위해서는




PendingIntent pendingIntent = PendingIntent.getActivity(this, 
Integer.valueOf(phoneNumber) /* Request code */,
intent,
PendingIntent.FLAG_ONE_SHOT);



이렇게 pendin intent에서 request code를 변경해서 똭!!!!!!!


해주면 됩니다.


이 작업을 하면서 좀 배워갑니다 ㅎㅎ


pending intent flag값에 대한 설명 : http://devmingsa.tistory.com/11


pending intent request code에 대한 설명 : http://iw90.tistory.com/221?category=633188



반응형