smack 라이브러리의 asmack 빌드를 사용하려고하지만 첫 번째 단계에서 멈추었습니다. 다음 코드는 host가 XMPPTCPConnection 내부에서 null임을 보여줍니다. 나는 로그는 단순히 I/XMPPChatDemoActivity(30917): Connection host null
라인을 보여줍니다 http://asmack.freakempire.de/asmack XMPPTCPConnection이 호스트를 무시합니다.
public class MainActivity extends Activity {
public static final String HOST = "talk.google.com";
public static final int PORT = 5222;
public static final String SERVICE = "gmail.com";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Context context = getApplicationContext();
SmackAndroid asmk = SmackAndroid.init(context);
ConnectionConfiguration connConfig = new ConnectionConfiguration(HOST, PORT, SERVICE);
connConfig.setSecurityMode(SecurityMode.enabled);
connConfig.setReconnectionAllowed(true);
XMPPTCPConnection connection = new XMPPTCPConnection(connConfig);
Log.i("XMPPChatDemoActivity", "Connection host " + connection.getHost());
}
}
에서 버전을 사용할 수있는 항아리의 4.0.0과 4.0.4을 테스트했습니다.
실제 Android 4.0 기기에서 테스트 중입니다. ProGuard는 비활성화되었으므로 ant debug
모드로 컴파일 중입니다.
@Flow 감사합니다. 나는 gtalk 서비스에 연결하기위한 전체 예제를 시작했다. 실패 할 때마다 코드를 제거해 봤고, 위의 내용은 결국 내가 얻은 것이다. – clapas