在应用程序中重新初始化对讲机

Re initialize Intercom in Application

我们在 Intercom 中有多个工作区。在应用程序中,我们想要更改工作区,而不需要重新启动应用程序。官方文档说使用:Intercom.client().logout()然后再初始化Intercom。但是不行,appKey和appId没有变。我们该怎么做?

根据 Intercom 文档,我怀疑您尝试实现的目标是不可能的。 logout 的文档指出它只是重置了关于用户的部分,而不是完整的内部通信设置:

Logout is used to clear all local caches and user data the Intercom SDK has created. Use this at a time when you wish to log a user out of your app or change a user.

至少在 public API 中,没有 "unregister" 可以撤消在 initialize 调用期间完成的 Intercom 单例实例的创建.我能看到的唯一其他方法是 registerForLaterInitialisation 但这听起来好像你之后仍然只能 initialize 一次。

如果您正在寻找触发应用重启以进行切换的方法,我发现 Phoenix Library 对于在内部测试设置更改后触发重启很有用。但是当然,这取决于您的要求,因为您已经提到您希望在不重启的情况下实现切换。

您可以将您的问题添加到 Intercom Forum,他们的工程团队似乎会定期回复。