NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
  PendingIntent intent = PendingIntent.getActivity(context, 0, new Intent(context, main.class), 0);
  Notification notification = new Notification(R.drawable.main_icon, "취업스터디", System.currentTimeMillis());
  notification.defaults |= (Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
  
  notification.setLatestEventInfo(context, "title","msg", intent);
  nm.notify(1, notification);

 

위와같이 NotificationManager 를이용하여 알림을 등록할수있습니다.

 

그리고

NotificationManager NM = (NotificationManager)
         getSystemService(NOTIFICATION_SERVICE);
      
         NM.cancel(1);

 

위와같은방법으로어플에 진입했을때 알림이온표시를 없앨수있습니다.

 

제가궁금한건 알림이오고 그걸눌러서 어플에 들어올경우 제가보낸 title나 msg를 알수있는 방법이혹시 있는지 궁금합니다.