连接到 Google Play 项目中所有活动的游戏服务

Connecting to Google Play game services for all activities within a project

基于来自 (https://github.com/playgameservices/android-basic-samples) 的 Google Play 游戏服务样本,特别是 TypeANumber,我想知道是否最好将所有活动实现为 片段(除了负责实例化和连接到 GoogleApiClient 的 MainActivity)如果我希望我的应用程序一直连接到服务。

因为,我已经开发了一个游戏应用程序,其中包含使用 Bundle 和 Intents 相互转换的活动,现在我才刚刚开始弄清楚如何实现 Google 玩游戏服务我的游戏。我已经阅读了教程等等,但我只是想知道是否建议将片段用于其他活动。

换句话说,您几乎只是在问 ActivityFragment 之间使用哪个更好。从技术上讲,它仍然取决于您的目标。环顾社区一段时间,发现这些帖子的答案非常详细:

Dilemma: when to use Fragments vs Activities:

Why fragments, and when to use fragments instead of activities?

简而言之,当需要可重用性时,我更喜欢使用 Fragment