天道酬勤,学无止境

asmack

Integrating Smack with Android Studio project for chat application

问题 我正在尝试使用 ejabberd 服务器和 smack 库实现聊天信使,但很难集成所有 jar 和 smack 的依赖项。 我正在使用安卓工作室。 我的 build.gradle(模块): apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.nit.xmppclient" minSdkVersion 18 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.2.0' compile "org.igniterealtime

2022-04-21 10:07:08    分类:技术分享    android   xmpp   ejabberd   smack   asmack

Smack 4.1.0 android Roster not displaying

问题 我正在尝试显示所有可用的联系人,即使它没有显示它 代码: Roster roster = Roster.getInstanceFor(connection); Collection<RosterEntry> entries = roster.getEntries(); System.out.println("ENTRIEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESS"); int roster_counter = 0; for (RosterEntry entry : entries) { roster_counter++; try { System.out.println("Here is Roster " + Integer.toString(roster_counter) + ": " + entry); }catch (Exception e){ System.out.println("2222222222222222222222"); System.out.println(e); } } 输出: 04-01 18:07:41.535 2756-2776/com.example.example I/System.out﹕ ##################################################

2022-04-20 10:14:05    分类:技术分享    android   xmpp   smack   asmack

asmack - can't read VCard

I did exactly what the answer suggested ( Asmack not loading VCard ) but it still doesn't work. The DEBUG output shows that Smack receives the packet with the VCard information but then throws a ClassCastException in https://github.com/rtreffer/smack/blob/master/source/org/jivesoftware/smackx/packet/VCard.java#L548 and all I get is 'No VCard for xxx@xxx'. My code: public VCard getUserVCard() throws XMPPException { VCard userVCard = new VCard(); userVCard.load(connection); return userVCard; } And some previous initialization: ConnectionConfiguration config = new ConnectionConfiguration(OF_HOST

2022-04-17 00:47:54    分类:问答    java   android   smack   vcf-vcard   asmack

Integrating Smack with Android Studio project for chat application

I am trying to implement a chat messenger using ejabberd server and smack library but having a hard time to integrate all the jars and dependencies of smack. I am using android Studio. My build.gradle(module): apply plugin: 'com.android.application' android { compileSdkVersion 22 buildToolsVersion "22.0.1" defaultConfig { applicationId "com.example.nit.xmppclient" minSdkVersion 18 targetSdkVersion 22 versionCode 1 versionName "1.0" } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile

2022-04-06 05:45:19    分类:问答    android   xmpp   ejabberd   smack   asmack

Smack 4.1.0 android Roster not displaying

I am trying to display all available contacts even though it is not displaying it Code: Roster roster = Roster.getInstanceFor(connection); Collection<RosterEntry> entries = roster.getEntries(); System.out.println("ENTRIEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEESS"); int roster_counter = 0; for (RosterEntry entry : entries) { roster_counter++; try { System.out.println("Here is Roster " + Integer.toString(roster_counter) + ": " + entry); }catch (Exception e){ System.out.println("2222222222222222222222"); System.out.println(e); } } output: 04-01 18:07:41.535 2756-2776/com.example.example I

2022-03-20 00:16:34    分类:问答    android   xmpp   smack   asmack

asmack : Receiving custom IQ messages in PacketListener

I am using asmack library for an XMPP chat application. I have some issues in receiving few custom IQ packets. This is my PacketListener code : PacketTypeFilter filter = new PacketTypeFilter(Packet.class); connection.addPacketListener(new PacketListener() { @Override public void processPacket(Packet packet) { Log.i("PacketListener : ", "Received Packet in General : " + packet.toXML()); } }, filter); It receives some IQ packets, but doesn't receive some other IQ packets. But, the asmack library is able to receive and print all the IQ packets in the Logcat under the Tag "SMACK" and a prefix as

2022-03-17 16:45:55    分类:问答    android   xmpp   asmack