<p dir="auto">I would like to use <a href="https://developers.google.com/games/services/android/turnbasedMultiplayer" rel="nofollow">https://developers.google.com/games/services/android/turnbasedMultiplayer</a> for a Flutter app I am writing. How would I do that with Dart/Flutter?<br>
( I asked on the mailing list, then on gitter, then I asked on stack overflow and there I was told to ask here. )<br>
It seems developers need a guide on using GPGS in Flutter. Thanks.</p>
<p dir="auto">From the <a href="https://firebase.google.com/docs/cloud-messaging/android/client#sample-play" rel="nofollow">docs</a>:</p>
<blockquote>
<p dir="auto">Apps that rely on the Play Services SDK should always check the device for a compatible Google Play services APK before accessing Google Play services features. It is recommended to do this in two places: in the main activity's onCreate() method, and in its onResume() method. The check in onCreate() ensures that the app can't be used without a successful check. The check in onResume() ensures that if the user returns to the running app through some other means, such as through the back button, the check is still performed.</p>
<p dir="auto">If the device doesn't have a compatible version of Google Play services, your app can call <code class="notranslate">GoogleApiAvailability.makeGooglePlayServicesAvailable()</code> to allow users to download Google Play services from the Play Store.</p>
</blockquote>
<p dir="auto">The google_sign_in plugin already <a href="https://github.com/flutter/plugins/blob/master/packages/google_sign_in/android/src/main/java/io/flutter/plugins/googlesignin/GoogleSignInPlugin.java#L458">ensures</a> Google Play Services is present and I think the Firebase Android plugins should as well -- they could attach lifecycle listeners to the activity to check for <code class="notranslate">onCreate</code> and <code class="notranslate">onResume</code> automatically.  (We could also expose a Dart API for it, but I'd rather not since it's Android specific.)</p>
<p dir="auto">I don't think there's an easy way for plugins to prevent the Flutter app from starting up but the plugins could queue up method calls until the error is resolved.</p>
<p dir="auto">This issue is based on a conversation with <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/lukef/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/lukef">@lukef</a> although I think Posse has already worked around it.</p>