android - Can't connect to Google Games API with 11.0.2 Play Services -
i know stackoverflow has lot of questions regarding issue 1 related recent changes in games development. first of there no strict guide integrating games api. @ least didnt find fresh. 1 guide simple sign in , basegameutils not suitable new changes anymore. tried - doesn't work. perhaps faced issue.
i able connect client mapiclient.hasconnectedapi(games.api)
stull returns false
on onconnected
method.
i've added sha-1 keys both release , debug versions , in google console see auto-generated ids web , android clients. last 1 added string server_client_id
. i've downloaded google-services.json
file. yeah, , manifest has meta-data:
<meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
my current code:
oncreate():
googlesigninoptions gso = new googlesigninoptions.builder(googlesigninoptions.default_games_sign_in) //.requestserverauthcode(getstring(r.string.server_client_id)) //.requestscopes(new scope(scopes.games), new scope(scopes.profile)) .build(); mapiclient = new googleapiclient.builder(this) .addapi(games.api) .addapi(auth.google_sign_in_api, gso) //.addscope(games.scope_games) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .build();
onstart():
mapiclient.connect(googleapiclient.sign_in_mode_optional);
onconnected():
if (mapiclient.hasconnectedapi(games.api)) { //always returns false auth.googlesigninapi.silentsignin(mapiclient).setresultcallback(new resultcallback<googlesigninresult>() { @override public void onresult(@nonnull googlesigninresult googlesigninresult) { // in case, sure result success. googlesigninaccount acct = googlesigninresult.getsigninaccount(); } }); }
also tried this guide didn't work. couldn't sign in , resolveissue
called time. guess it's obsolete.
could suggest fresh solution tested working?
Comments
Post a Comment