简体   繁体   中英

Login for chat in QuickBlox for Android app

I am developing an Android application for chatting and I am using Quickblox for the same. I am integrating QuickBlox " quickblox-android-1.2.4.jar " library for QuickBlox SDK 1.2.4 in my android application. I have read this , this and many other link tutorials of QB. The code runs exactly as I wish but the problem occurs when I use Proguard QBChatService.getInstance().loginWithUser doesn't work. My code for that is:

QBChatService.getInstance().loginWithUser(user,
                    new SessionCallback() {
                        @Override
                        public void onLoginSuccess() {

                            Log.i("success when login", "success:");

                        }

                        @Override
                        public void onLoginError(String error) {
                            Log.i("Error", "Error: " + error);
                        }
                    });

But it neither prints success when login nor Error . Don't know why ? This runs completely fine if I remove Proguard and run this in my other demo app. So the only plausible reason can be due to Proguard. Can you help me out in this issue by mentioning which classes to keep in my "proguard-project.txt"(if that is the case).

I have already mentioned below classes:

#QuickBlox
-keep class org.jivesoftware.smack.initializer.VmArgInitializer { public *; } 
-keep class org.jivesoftware.smack.ReconnectionManager { public *; }
-keep class com.quickblox.module.c.a.c { public *; }
-keep class com.quickblox.module.chat.QBChatService { public *; }
-keep class com.quickblox.module.chat.QBChatService.loginWithUser { public *; }
-keep class com.quickblox.module.chat.listeners.SessionCallback { public *; }
-keep class * extends org.jivesoftware.smack { public *; }

I have obviously written the code for QBAuth.createSession , before logging in and that works with success as mentioned here . So that is not the case.

Please suggest me if I am missing out something here. Thanks in Advance.

I had similar problems, I needed to expand my proguard config to be the following and it is now working for me:

-keep class org.jivesoftware.smack.** { public *; }
-keep class org.jivesoftware.smackx.** { public *; }
-keep class com.quickblox.** { public *; }
-keep class * extends org.jivesoftware.smack { public *; }
-keep class * implements org.jivesoftware.smack.debugger.SmackDebugger { public *; }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM