public class GCMIntentService extends GCMBaseIntentService{
클래스 MESSAGE 부분=================
private void showMessage(Context context, Intent intent){
String name=null;
String msg=null;
String time=null;
try {
name = URLDecoder.decode(intent.getStringExtra("name"),"EUC-KR");
msg = URLDecoder.decode(intent.getStringExtra("msg"),"EUC-KR");
time = URLDecoder.decode(intent.getStringExtra("time"),"EUC-KR");
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
NotificationManager notificationManager = (NotificationManager)context.getSystemService(Activity.NOTIFICATION_SERVICE);
// 해당 어플을 실행하는 이벤트를 하고싶을 때 아래 주석을 풀어주세요
// PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
// new Intent(context, TabmainActivity_3.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK), 0);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
new Intent(context, TabmainActivity_3.class).setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP), 0);
//PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, new Intent(), 0);
Notification notification = new Notification();
notification.icon = R.drawable.ic_ds;
notification.tickerText = time;
notification.when = System.currentTimeMillis();
notification.vibrate = new long[] { 500, 100, 500, 100 };
notification.sound = Uri.parse("/system/media/audio/notifications/20_Cloud.ogg");
notification.flags = Notification.FLAG_AUTO_CANCEL;
notification.setLatestEventInfo(context, name, msg, pendingIntent);
((StartChatting)(StartChatting.ContextStart)).update();// 이부분으로 채팅방 리스트뷰 갱신하면서
notificationManager.notify(0, notification);
}
=========================================================================================================
상대방하고 제가 서로 채팅방 안에 있습니다 startChatting.class 에서 대화를 하는데
서로 입력한 것이 서로 채팅방에 켜 있는 데도 메세지 알림으로 출력이 됩니다.
여기서 채팅방이 열려 있을경우 notification 을 안하고 업데이트 부분만 할려고하는데
if()문에서 조건을 뭘루 해야되나요?? 현재 startChatting.class가 실행상태인지 어떻게 확인할수 있을까요??
startChatting.contextStart== start()인상태????
인가요ㅠㅠ
onStart하고 onPause에 static boolean 하나로 체크해주세요