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

블루투스 연결에 따라 Notification의 아이콘을 변경하고 싶습니다.

0 추천
아이콘을 변경하고 싶은데..

        Notification notification;

        notification = new Notification.Builder(this).setSmallIcon(R.drawable.ic_launcher)
                .setWhen(System.currentTimeMillis())
                .setContentTitle(getResources().getString(R.string.noti_title))
                .setContentText(getResources().getString(R.string.noti_content))
                .addAction(R.drawable.x,getResources().getString(R.string.noti_finish), pfinishIntent)
                .setContentIntent(pendingIntent)
                .setPriority(NotificationCompat.PRIORITY_MAX) // 우선 순위 조정
                .build();

 

Notification을 서비스 클래스에서 startForeground(NOTIFICATION_ID, notification);

실행시키고 있습니다.

 

블루투스 상태에 따라 Notification의 아이콘을 변경하고 싶은데 어떻게 해야하나요?

 

블루투스 상태를 받아서 Notification을 업데이트해야할거같은데... 어떤식으로 해야할까요?
쿠쿠부다스 (6,470 포인트) 님이 2017년 1월 25일 질문

1개의 답변

+1 추천

노티피케이션은 아이디가 다를 경우 1, 2, 3 식으로 다른 노티피케이션으로 각각 나타나게 되고

아이디가 같을경우 교체가 됩니다 ^^.. 이것만으로 답이 나왔죠..?

NOTIFICATION_ID 를 유지한채로 새로 만들어서 startForeground(NOTIFICATION_ID, notification);

돌려보시면 됩니다. 

라쎄린드 (25,460 포인트) 님이 2017년 1월 25일 답변
...