简体   繁体   English

在QuickBlox for Android应用中登录聊天

[英]Login for chat in QuickBlox for Android app

I am developing an Android application for chatting and I am using Quickblox for the same. 我正在开发一个用于聊天的Android应用程序,我正在使用Quickblox。 I am integrating QuickBlox " quickblox-android-1.2.4.jar " library for QuickBlox SDK 1.2.4 in my android application. 我正在我的Android应用程序中为QuickBlox SDK 1.2.4集成QuickBlox“ quickblox-android-1.2.4.jar ”库。 I have read this , this and many other link tutorials of QB. 我看了这个这个和QB的许多其他链接教程。 The code runs exactly as I wish but the problem occurs when I use Proguard QBChatService.getInstance().loginWithUser doesn't work. 代码完全按照我的意愿运行,但是当我使用Proguard QBChatService.getInstance()时会出现问题.loginWithUser不起作用。 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. 如果我删除Proguard并在我的其他演示应用程序中运行它,则运行完全正常。 So the only plausible reason can be due to Proguard. 所以唯一可信的原因可能是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). 你可以通过提及我的“proguard-project.txt”中保留哪些类来帮助我解决这个问题(如果是这种情况)。

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 . 我已经很明显书面QBAuth.createSession代码,登录前和成功的作品提到这里 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: 我遇到了类似的问题,我需要将我的proguard配置扩展为以下内容,现在它正在为我工​​作:

-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 *; }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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