android - 跨平台(iOS 和 Android)聊天不适用于 chat21 SDK
问题描述
我们正在为 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 都不同。
解决方案
通过替换APP_ID
为"chat"
(iOS 树的同名)。以前,我使用的是 Firebase APP_ID
,它指的是 Firebase。这是我的应用程序的租户名称,并且对于使用 chat 的所有客户端都必须相同。这解决了问题!感谢团队!
推荐阅读
- c++ - Fstream在读取文件时给出空行,与pthreads一起使用
- python - 如何检查我的代码是否在 SLURM 环境中运行?
- c++ - 在 CreateConstantBufferView 处超出虚拟地址的末尾
- linux - 如何更新我的 libthread_db 共享库以匹配 libpthread 共享库?
- javascript - React Webpack 无效的选项对象。CSS Loader 已使用选项对象初始化
- c# - 实体框架 6 中的更新数据库命令不起作用
- javascript - JavaScript 生成器及其原型链
- android - ViewModel 正在为 recyclerview 复制项目
- mysql - 按客户选择,他最近的订单中最贵的产品名称
- reactjs - 使用 React 重定向到另一条路线