2011-10-06 2 views
0

여러 소스에서 메시지를 수신 할 수있는 응용 프로그램이 있습니다. 상태 표시 줄에 각 소스를 알리는 알림을 보내고 싶습니다.NotificationManager, 여러 아이콘, 하나만 활동을 시작할 수 있습니다.

이제 호출에서 고유 한 notifyId_를 지정하면 mNotificationManager.notify (notifyId_, notifyDetails);

Android는 상태 표시 줄에 여러 아이콘을 표시하지만 하나의 아이콘 만 필요합니다. 동일한 notifyId_를 사용하면 하나의 아이콘이 표시되지만 알림 세부 정보를 볼 때 하나만 표시됩니다. 여러 고유 ID가있는 아이콘 하나를 가져올 수있는 방법이 있습니까?

큰 문제. 여러 개의 아이콘과 고유 ID로 이동하면 Android (2.2)가 1 개 이상의 의도가 보류 중일 때 PendingIntent를 제대로 실행하지 않습니다. 나는 나의 3 개의 근원을 시험했다, 각자 혼자서 일한다. 최대한 빨리이 상태 표시 줄에 하나 개의 아이콘보다 creater을 가지고, 하나 개의 활동을 시작할 수 있습니다, 다른 사람 말 : 전송 contentintent이

코드의 초점 이득을 무시하고, 이미 집중 pendingintentcanceledexception 창을 실패는 다음과 같습니다

int notifyId_ = 237; 
public void createNotification(String source, String person) 
{ 
    notifyId_++; 
    Context context = getApplicationContext(); 

    Intent notifyIntent = new Intent(context, MessengingActivity.class); 
    notifyIntent.putExtra("name", person); 
    notifyIntent.putExtra("notifyId", notifyId_); 

    PendingIntent pi = PendingIntent.getActivity(SentinelActivity.this, 0, notifyIntent, 
      Intent.FLAG_ACTIVITY_MULTIPLE_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); 


    Notification notifyDetails = new Notification(R.drawable.icon, "Text message(s) from " + source, System.currentTimeMillis()); 
    notifyDetails.setLatestEventInfo(context, source, "Conversation updated", pi); 
    NotificationManager mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE); 
    mNotificationManager.notify(notifyId_, notifyDetails); 
} 

통찰력에 감사드립니다.

답변

0

알림 개체의 숫자 속성 사용

+0

예제를 제공 할 수 있습니까? –

관련 문제