Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 435
Name is Nilay Avatar asked Dec 10 '25 10:12

Name is Nilay


1 Answers

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 *; }
like image 160
Jake Hall Avatar answered Dec 13 '25 02:12

Jake Hall



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!