내 IM 응용 프로그램을 Android (xmpp & GCM을 사용하여) 개발을 마쳤으며 gm을 사용하여 UpPayload 및 DownPayloads ......... gm을 사용하여 사용자에게 그의 파트너 온라인/온라인입니다 내 xmpp 서버가 상태를 알려주는 을 "이해합니다"라는 메시지를 보냅니다. GCM 및 xmpp를 통해 입력 상태/온라인 상태
protected void onStart() {
super.onStart();
if(!isOnlineSent)
{SendOnlineStatus("Online");
isOnlineSent=true;}
.
.
.
.}
및 SendOnlineStatus처럼 : 서버
payload.get (ConstantsGCM.TYPECLM)의 값을 확인
Intent OnlineMsg = new Intent();
OnlineMsg.putExtra("action", "com.Esmaeel.sodfarim.sodfa01.MESSAGE");
String nowtime = String.valueOf(EsTools.getCurrentTime());
OnlineMsg.putExtra(ConstantsGCM.TYPECLM, ConstantsGCM.ONST);
OnlineMsg.putExtra(ConstantsGCM.STATUS_on_of, Status);
OnlineMsg.putExtra(ConstantsGCM.TO_CLM, "-01");
OnlineMsg.putExtra(ConstantsGCM.FROMCLM, UUID);
OnlineMsg.putExtra(ConstantsGCM.MESSAGE_ID_CLM, regid + nowtime);
OnlineMsg.putExtra(ConstantsGCM.NAME_CLM, "Name");
final Bundle bndl = OnlineMsg.getExtras();
new AsyncTask() {
@Override
protected String doInBackground(Object[] objects) {
if (ggcm == null) {
ggcm = GoogleCloudMessaging.getInstance(context);
}
try {
ggcm.send(PRO_ID + ConstantsGCM.GCM_SERVER, bndl.getString(ConstantsGCM.MESSAGE_ID_CLM), bndl); //// GCM_SERVER="gcm.googleapis.com"
} catch (IOException e) {
e.printStackTrace();
}
return "";
}
}.execute(null, null, null);
; 서버 ONST 유형이 payload.get (ConstantsGCM.STATUS_on_of) 값을 읽는 경우; payload.get의 유효 사용 금액 (ConstantsGCM.STATUS_on_of); "온라인"또는 "오프라인"입니다.
서버는 사용자 상태를 업데이트하고 모든 사용자의 친구에게 새로운 상태를 보냅니다.
내가 입력 한 상태와 동일하지만 활성 채팅의 상대방에게 보내는 마지막 단계입니다. 에 대한 하지만 나는 그가 오프라인 일 때 사용자가 "같은 문제는 온라인 apear 얻고, 그가하지 않을 때 몇 번 타이핑을 apears. 어떤 도움 이상의 effictive 아이디어? 내가 타이핑 부분에 대해 모르는
언제해야할까요? 우리가 이야기하는 동안 오프라인으로 간다면? 안돼 : 앱이 보이는지, 복잡한 지 알 수있는 직접적인 방법이 없음 –
아니요, 이벤트가 발생할 때 메시지를 보냅니다 (사용자 상태 변화), 친구가 메시지 AN을 수신하면 D (또는 필요할 때마다) 대화를 열면 상태를 확인하고 표시합니다. – liltof
여기에 주요한 problrm입니다 : 사건 : 당신은 (오프라인) 사건이 일어날 때 알 수 없습니다 .. 사용자가 집 버튼을 눌러서 대화를 할 수 없지만 알 수없는 경우 (개발자로서 매번 오프라인으로 보낼 수 없음) (V) >> –