区分调用 onConnected 的多个 Google API

Differentiate between multiple Google APIs calling onConnected

所以我有一个应用程序,它既使用 google+ api 允许用户登录,又使用强制转换 api 允许用户将内容投射到Chromecast.

但是,两个 API 使用相同的连接回调。

区分哪些 API 应该收到连接回调通知的最佳做法是什么?

例如,onConnected() 在用户成功登录时调用。但在与 chromecast 建立连接时也会调用。如何区分这两种情况?

编辑:所以我从 Google 中找到了这个信息:

Note that the contents of the connectionHint Bundle are defined by the specific services. Please see the documentation of the specific implementation of GoogleApiClient you are using for more information.

但是,我找不到描述不同 APIs 的 connectionHint 内容的文档。

Edit2:我可以为每个 API 创建一个单独的 API 客户端吗?

最简单的方法是使用多个客户端,每个客户端一个 API,然后为它们附加单独的回调以便能够区分它们。