Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android and XMPP: Currently available solutions [closed]

Smack

Smack is a open-source XMPP client library. Since version 4.1 it runs natively on Android. For more information have a look at the "Smack 4.3 Readme" and see the Smack project page at Ignite Realtime.


I recently stumbled across another open-source solution: jaxmpp2

jaxmpp2 also targets Android (and Java SE). I can't really say anything else about it, because I don't use jaxmpp2 in my Android/XMPP projects. But it looks like a valid alternative to aSmack.


Use qsmack for android

https://code.google.com/p/qsmack/downloads/list

Its the latest build for Android

I have worked on one to one chat, group chat, video transfer, audio transfer, last seen, change registration number... almost complete whats app. I have created lots of plugin on openfire


I would like to use libstrophe and jni. Goals to use this is cross platform, simple to use and performance. libstrophe is written in c so, it easy to write android makefile since the dependency is only openssl and expat lib. In my case, I'm using openssl and expat lib from libjingle which already port to android and ios. (Just need to port gyp file to android makefile or IOS project).

Below is my android makefile



    LOCAL_PATH:= $(call my-dir)/../../libstrophe-0.8.7

    SSL_PROJECT_PATH := openssl/libs/android

    include $(CLEAR_VARS)

    LOCAL_MODULE := openssl

    OPENSSL_LIB_NAME := lib$(LOCAL_MODULE).a

    LOCAL_CFLAGS := -DL_ENDIAN \
        -DOPENSSL_THREADS \
        -DPURIFY \
        -DTERMIO \
        -D_REENTRANT \
        -DOPENSSL_NO_HW \
        -DOPENSSL_NO_GOST \
        -DOPENSSL_NO_DTLS1 \
        -DOPENSSL_NO_RDRAND \
        -DOPENSSL_NO_RSAX \
        -Wall -pipe -fno-exceptions -fno-rtti -fstrict-aliasing -mfpu=neon -mfloat-abi=softfp


    OPENSSL_PATH := openssl/openssl
    OPENSSL_PATH_INC := $(LOCAL_PATH)/openssl/openssl

    LOCAL_C_INCLUDES := \
        $(OPENSSL_PATH_INC) \
        $(OPENSSL_PATH_INC)/include \
        $(OPENSSL_PATH_INC)/crypto \
        $(OPENSSL_PATH_INC)/crypto/asn1 \
        $(OPENSSL_PATH_INC)/crypto/evp \
        $(OPENSSL_PATH_INC)/crypto/modes \
        $(LOCAL_PATH)/openssl/config/android \
        $(LOCAL_PATH)/openssl

    LOCAL_ARM_MODE := arm
    LOCAL_CFLAGS += $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK


    LOCAL_SRC_FILES := \
        // here is openssl file which is defined in gyp

    LOCAL_SHORT_COMMANDS := true

    include $(BUILD_SHARED_LIBRARY)


    include $(CLEAR_VARS)

    STROPHE_PATH := $(LOCAL_PATH)
    EXPAT := expat-2.1.0
    OPENSSL_PATH := openssl/openssl
    OPENSSL_PATH_INC := $(LOCAL_PATH)/openssl/openssl


    EXPAT_SRC_FILES := \
        $(EXPAT)/lib/xmlparse.c \
        $(EXPAT)/lib/xmlrole.c \
        $(EXPAT)/lib/xmltok.c

    COMMON_CFLAGS := \
        -Wall \
        -Wmissing-prototypes -Wstrict-prototypes \
        -Wno-unused-parameter -Wno-missing-field-initializers \
        -fexceptions \
        -DHAVE_EXPAT_CONFIG_H \
        -DLOGGING -DANDROID \



    COMMON_C_INCLUDES += \
        $(LOCAL_PATH)/$(EXPAT)/lib \
        $(STROPHE_PATH) \
        $(STROPHE_PATH)/src \
        $(OPENSSL_PATH_INC) \
        $(OPENSSL_PATH_INC)/include \
        $(OPENSSL_PATH_INC)/crypto \
        $(OPENSSL_PATH_INC)/crypto/asn1 \
        $(OPENSSL_PATH_INC)/crypto/evp \
        $(OPENSSL_PATH_INC)/crypto/modes \
        $(LOCAL_PATH)/openssl/config/android \
        $(LOCAL_PATH)/openssl \
        ../android/jni


    STROPHE_SRC_FILES := src/auth.c \
        src/conn.c \
        src/ctx.c \
        src/event.c \
        src/handler.c \
        src/hash.c \
        src/jid.c \
        src/md5.c \
        src/sasl.c \
        src/scram.c \
        src/sha1.c \
        src/snprintf.c \
        src/sock.c \
        src/stanza.c \
        src/thread.c \
        src/tls_openssl.c \
        src/util.c \
        src/parser_expat.c \
        src/message.c \
        src/presence.c \
        src/roster.c


    JNI_SRC_FILES := ../android/jni/strophe-jni.c

    ifeq ($(TARGET_ARCH),arm)
        LOCAL_SDK_VERSION := 8
    else
        LOCAL_SDK_VERSION := 9
    endif

    LOCAL_ARM_MODE := arm
    LOCAL_SHORT_COMMANDS := true
    LOCAL_SYSTEM_SHARED_LIBRARIES := libc
    LOCAL_SHARED_LIBRARIES := openssl

    LOCAL_SRC_FILES := $(EXPAT_SRC_FILES)
    LOCAL_SRC_FILES += $(STROPHE_SRC_FILES)
    LOCAL_SRC_FILES += $(JNI_SRC_FILES)

    LOCAL_CFLAGS += $(COMMON_CFLAGS)
    LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -llog
    LOCAL_CFLAGS += $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK
    LOCAL_C_INCLUDES += $(COMMON_C_INCLUDES)


    LOCAL_MODULE:= libnativeclient
    LOCAL_MODULE_TAGS := optional

    include $(BUILD_SHARED_LIBRARY)