제가 gcm을 사용해서 채팅방을 만들고 있습니다.
GCMBaseIntentService 을 사용해서
onMessage를 통해서 메세지를 수시하고 알림을 띄어주는구조입니다,
문제는 알림을 누르면 메세지가 온 채팅방으로 이동해야하는데
@Override
protected void onMessage(Context arg0, Intent arg1) {
Bundle extras = arg1.getExtras();
if (extras.get("type").equals("1")) {
String name = (String) extras.get("name");
String messege = (String) extras.get("messege");
String phone = (String) extras.get(SuperKey.LOGINDATA_PHONE_KEY);
String wn = (String) extras.get("ANOTHER");
sendToastMessage(arg0, "서버로부터 메시지를 받았습니다.");
Intent intent = new Intent(getApplicationContext(),
Nighttalk_Chet_Detail_phsh.class);
intent.putExtra(SuperKey.LOGINDATA_PHONE_KEY, wn);
intent.putExtra("ANOTHER", phone);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
PendingIntent pintent = PendingIntent.getActivity(
getApplicationContext(), 0, intent, 0);
NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
Notification notification = new NotificationCompat.Builder(
getApplicationContext()).setContentTitle(name + "님의 메세지")
.setContentText(messege).setSmallIcon(R.drawable.ico_bird)
.setTicker(name + "님의 메세지가 도착하였습니다.").setAutoCancel(true)
.setContentIntent(pintent).build();
notification.defaults |= (Notification.DEFAULT_SOUND);
notificationManager.notify(Integer.parseInt(wn), notification);
}
}
위와같이 작성을 하였는데요 만약 회원이 저와 1번 2번 이있고 저와 1번, 저와2번 이 각각 채팅방이 생성되어있습니다.
문제는 처음에 1번에 저에게 메세지를 보내면 알림이 뜨고 알림을 누르면 Nighttalk_Chet_Detail_phsh.class(1:1채팅엑티비티)이 열리고 1번과 저의 채팅내용이 잘뜨고 있습니다.
그런대 그후에 2번이 저에게 메시지를 보내면 알림까지는 잘뜨는대 알림을 누르면 2번과의 채팅방이 생성되지 않고 1번과의 채팅방이 열립니다.
ㅜㅜ 부족한 내용이지만 도와주세요