gpt4 book ai didi

android - Roid 私聊问题

转载 作者:行者123 更新时间:2023-11-29 01:15:23 26 4
gpt4 key购买 nike

我无法创建私有(private)创建聊天对话框。我正在尝试为 id 19 创建静态私有(private)聊天对话框。

我在 PrivateChatManager 上得到空对象引用

public class ChattingFragment extends Fragment {
public static final String APP_ID = "*****";
public static final String AUTH_KEY = "********";
public static final String AUTH_SECRET = "*********";
public static final String ACCOUNT_KEY = "*************";

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_chatting, container, false);

QBSettings.getInstance().init(getActivity(), APP_ID, AUTH_KEY, AUTH_SECRET);
QBSettings.getInstance().setAccountKey(ACCOUNT_KEY);


loginForQuickBlox();

QBAuth.createSession(new QBEntityCallback<QBSession>() {

@Override
public void onSuccess(QBSession session, Bundle params) {
Toast.makeText(getActivity(), "Sucess session", Toast.LENGTH_LONG).show();
}

@Override
public void onError(QBResponseException errors) {
Toast.makeText(getActivity(), "error session" + errors.getMessage(), Toast.LENGTH_LONG).show();
}
});


return rootView;
}

private boolean loginForQuickBlox() {
final QBUser user = new QBUser();
user.setEmail("emailid@email.com");
user.setPassword("123456789");

QBUsers.signIn(user, new QBEntityCallback<QBUser>() {
@Override
public void onSuccess(QBUser users, Bundle params) {
Toast.makeText(getActivity(), "Sucess login" + users.getId(), Toast.LENGTH_LONG).show();

/**here i have to create static dialog for chat with id 19 **/
QBChatService chatService = QBChatService.getInstance();
QBPrivateChatManager privateChatManager = chatService.getPrivateChatManager();
privateChatManager.createDialog(19, new QBEntityCallbackImpl<QBDialog>() {
@Override
public void onSuccess(QBDialog dialog, Bundle args) {

}


});

}

@Override
public void onError(QBResponseException errors) {

Toast.makeText(getActivity(), errors.getMessage(), Toast.LENGTH_LONG).show();
}
});

return true;
}
}

下面是我的logcat。

AndroidRuntime: FATAL EXCEPTION: main
Process: com.archi.intrisfeed, PID: 24211
java.lang.NullPointerException: Attempt to invoke virtual method 'com.quickblox.core.QBRequestCanceler com.quickblox.chat.QBPrivateChatManager.createDialog(int, com.quickblox.core.QBEntityCallback)' on a null object reference
at com.archi.intrisfeed.fragment.ChattingFragment$3.onSuccess(ChattingFragment.java:102)
at com.archi.intrisfeed.fragment.ChattingFragment$3.onSuccess(ChattingFragment.java:96)
at com.quickblox.core.Query.notifySuccess(Query.java:372)
at com.quickblox.core.Query$VersionEntityCallback.completedWithResponse(Query.java:404)
at com.quickblox.core.Query.completedWithResponse(Query.java:277)
at com.quickblox.core.server.HttpRequestRunnable$1.handleMessage(HttpRequestRunnable.java:42)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
10-18 12:55:54.181 1224-1224/? E/libEGL: called unimplemented OpenGL ES API

最佳答案

您应该在创建对话框之前登录聊天(如果您使用 QuickBlox Android SDK 版本 2.6.1 或更早版本)请参阅 link .从 3.0 版开始,您可以使用 QBRestChatService 类创建对话框,详细信息 link

关于android - Roid 私聊问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40101216/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com