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

여러개의 통보가 올때 상단바에..?

0 추천

여러개의 통보가 올때 상단바에 하나만 나타나요

어떻게 하면 여러개가 나타나나요?

 

        int icon = R.drawable.ic_stat_gcm;
        long when = System.currentTimeMillis();
        NotificationManager notificationManager = (NotificationManager)
                context.getSystemService(Context.NOTIFICATION_SERVICE);
        Notification notification = new Notification(icon, message, when);
        String title = context.getString(R.string.app_name);
        Intent notificationIntent = new Intent(context, DemoActivity.class);
        // set intent so it does not start a new activity
        notificationIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
       // notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP |
       //         Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
        PendingIntent intent =
                PendingIntent.getActivity(context, 0, notificationIntent, 0);
        notification.setLatestEventInfo(context, title, message, intent);
        notification.defaults = Notification.DEFAULT_ALL;
        notification.flags |= Notification.FLAG_SHOW_LIGHTS;
        notification.flags |= Notification.FLAG_AUTO_CANCEL;
        notificationManager.notify(0, notification);

헨씀히포 (3,660 포인트) 님이 2014년 1월 13일 질문

1개의 답변

+1 추천
 
채택된 답변
notificationManager.notify(0, notification);

아이디를 0으로만 지정해서그런듯합니다.

http://developer.android.com/reference/android/app/NotificationManager.html#notify(int, android.app.Notification)

id 파라미터 유니크한값을 정해준다고 써있는듯 아이디를 다르게 쓰면서 호출해보세요

bangbang (8,820 포인트) 님이 2014년 1월 13일 답변
헨씀히포님이 2014년 1월 13일 채택됨
아 그렇군요 감사합니다
...