【问题标题】:Cross platform ( iOS and Android ) chat does not work with chat21 SDK跨平台(iOS 和 Android)聊天不适用于 chat21 SDK
【发布时间】:2020-10-21 00:04:20
【问题描述】:

我们正在使用适用于 Android 和 iOS 的 chat-SDK chat21。

https://github.com/chat21/chat21-ios-demo

https://github.com/chat21/chat21-android-sdk

在我的 firebase 帐户下,我有 2 个应用程序,1 个用于 android,另一个用于 iOS。

对于 Android,我们使用 google-service.json 文件和 App ID

对于 iOS,我们使用 GoogleService-info.plist 文件来配置 chat21 SDK

但是,当我从 android 发送消息时,iOS 没有收到任何消息,这与从 iOS 到 android 应用程序发生的事情相同。

是因为我们使用不同的应用程序? (项目设置->您的应用程序部分)尽管 App ID 仅在 android 应用程序中使用,但两者都有不同的 App ID。

内部聊天我的意思是 iOS 到 iOS 和 android 到 android 聊天工作绝对正常,跨平台聊天不起作用。

如果我在配置中缺少某些东西,请告诉我,以便快速修复,谢谢

7 月 2 日更新

FirebaseDatabase.getInstance().setPersistenceEnabled(true);

ChatManager.startWithEmailAndPassword(this, [APP_ID],
[YOUR_EMAIL], [YOUR_PASSWORD], new ChatAuthentication.OnChatLoginCallback() {
@override
public void onChatLoginSuccess(IChatUser currentUser) {
ChatManager.getInstance().createContactFor(currentUser.getId(), currentUser.getEmail(),
[YOUR_FIRST_NAME], [YOUR_LAST_NAME], new OnContactCreatedCallback() {
@override
public void onContactCreatedSuccess(ChatRuntimeException exception) {
if (exception == null) {
ChatUI.getInstance().openConversationsListActivity();
} else {
// TODO: handle the exception
}
}
});
}

@override
public void onChatLoginError(Exception e) {
// TODO: 22/02/18
}
}); 

上面的 android 代码使用 app id 与 firebase 连接,并在 iOS 中从 plist 文件中获取 app_id。两个APP_Id都不一样。

【问题讨论】:

    标签: android ios firebase firebase-realtime-database chatsdk


    【解决方案1】:

    通过将APP_ID 替换为"chat"(iOS 树的同名)。以前,我使用的是Firebase APP_ID,它指的是Firebase。这是我的应用的租户名称,对于所有使用聊天的客户来说必须是相同的。这解决了问题!感谢团队!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-27
      • 2014-06-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多