【问题标题】:What are some methods of initializing server-client connections to an android client device?有哪些方法可以初始化与 android 客户端设备的服务器-客户端连接?
【发布时间】:2013-07-02 02:13:25
【问题描述】:

如果您正在使用 Android 手机客户端和服务器开发像 Chess 这样的回合制游戏

IE:玩家 A 提交轮到他们,服务器计算逻辑,将结果发送给玩家 A 和 B,并通知玩家 B 轮到他们了。

有哪些方法可以通过服务器联系android客户端而不保持持久连接?

我正在使用简单的 TCP 套接字来发送字符串数据,我想知道是否有办法可靠地做到这一点,因为我听说 android IP 地址在不断变化

【问题讨论】:

    标签: android client-server android-service android-networking tcpserver


    【解决方案1】:

    Google Cloud MessagingGCM。免费。它是无限的。它由谷歌维护。它已经安装在用户的手机上。

    话虽如此,现在理想的方法是使用Google Play Services 并让人们使用他们的 Google+ 帐户登录。在 Google Play 服务上观看上一届 Google I/O 2013 会议。演示在一般主题演讲期间出错,但在其他情况下运行良好。

    Google Play 服务会为您处理所有网络问题(如果用户在同一网络上,也会回退到本地 wifi)。您必须付出的代价是,如果用户想要多人游戏功能,您必须强制他们使用 Google+。

    【讨论】:

    • 为什么 Google Play 服务现在是首选方式?它是否通过 GCM 提供任何其他功能。到目前为止,在 GCM 上观看视频似乎完美/足够。似乎需要 Google+ 很麻烦
    猜你喜欢
    • 2016-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-26
    • 2015-05-21
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多