Google Describes How to Migrate to the New Play Games Services APIs

Google is getting ready to introduce version 11.6.0 of the Google Play Services SDK and with the new version of the SDK, they’re changing the way APIs are structured. The new update deprecates the GoogleApiClient class and introduces a decoupled collection of feature-specific API clients for the developer. With this change, there is a reduced amount of boilerplate code required to access the Play Games Services APIs. To ease developers into this transition, the company has published a new article showing how to migrate to the new Play Games Services APIs.

The entire goal of this new update to the Google Play Services SDK is to make the APIs easier to use, thread-safe, and to make them more memory efficient. Along with those targets, the new structure also makes use of the Task model to give better separation between your activity and handling the asynchronous results of the APIs. The changes might seem big at first, and they will likely have an impact on the development process and performance, but it should be a simple transition which results in much less clutter in your code.

One of the changes involves authentication as it is now explicitly done using the Google Sign-In client. This should make things more clear on the difference between a Google Sign-In identity and the Play Games Services identity, and how to control the authentication process. The second change involves converting all the Games. category static method calls to use the corresponding API client methods (including converting PendingResult usages to use the Task class). This should help with separation of concerns in your code, and reduces the amount of multi-threaded complexity.

The last big change here involves making sure that handling multi-player invitations is done explicitly through the turn-based and real-time multiplayer API clients. This is required because GoogleApiClient is no longer used and the invitation is now accessed through an explicit method call. Developers will definitely want to read through the details of these changes in the Google Developers Blog article. Google has also updated the Android Basic Samples project and  Client Server Skeleton project to use the Play Services API clients for anyone who wants to see them in action.

Source: Google Developers Blog
我来评几句
登录后评论

已发表评论数()