Google Play SignIn funktioniert nicht

  • Antworten:1
  • Bentwortet
Timer
  • Forum-Beiträge: 9

10.01.2018, 18:06:04 via Website

Hey,
ich habe gerade nach folgendem Tutorial ein SignIn eingerichtet:
developers.google.com/games/services/android/signin
Wenn ich die App nun auf meinem Handy starte, kommt anfangs das Google Play Login Fenster (anfangs ein drehender grüner Kreis und danach das Google Play Logo). Sobald sich das schließt, kommt ein leeres PopUp (nur ein Ok Button). Kurz darauf öffnet sich erneut das Google Play Login Fenster.
Leider wird mir in dem PopUp kein Fehler ausgegeben (wofür es eigentlich gedacht ist). Woran kann das liegen?

package de. ... . ...;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;

import com.google.android.gms.auth.api.Auth;
import com.google.android.gms.auth.api.signin.GoogleSignIn;
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
import com.google.android.gms.auth.api.signin.GoogleSignInClient;
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
import com.google.android.gms.auth.api.signin.GoogleSignInResult;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;


public class SignIn extends AppCompatActivity {
    private static final int RC_SIGN_IN = 9001;
    private void signInSilently() {
        if(GoogleSignIn.getLastSignedInAccount(this) == null) {
            GoogleSignInClient signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
            signInClient.silentSignIn().addOnCompleteListener(this, new OnCompleteListener<GoogleSignInAccount>() {
                @Override
                public void onComplete(@NonNull Task<GoogleSignInAccount> task) {
                    if (task.isSuccessful()) {
                        GoogleSignInAccount signedInAccount = task.getResult();
                    } else {
                        startSignInIntent();
                    }
                }
            });
        }
    }

    private void startSignInIntent() {
        GoogleSignInClient signInClient = GoogleSignIn.getClient(this, GoogleSignInOptions.DEFAULT_GAMES_SIGN_IN);
        Intent intent = signInClient.getSignInIntent();
        startActivityForResult(intent, RC_SIGN_IN);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == RC_SIGN_IN) {
            GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
            if (result.isSuccess()) {
                GoogleSignInAccount signedInAccount = result.getSignInAccount();
            } else {
                String message = result.getStatus().getStatusMessage();
                if (message == null || message.isEmpty()) {
                    message = getString(R.string.signin_other_error);
                }
                new AlertDialog.Builder(this).setMessage(message).setNeutralButton(android.R.string.ok, null).show();
            }
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
        signInSilently();
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_menu);
    }
}

Ich habe folgendes Tutorial befolgt, um eine Verbindung zwischen Google und meiner App herzustellen:
developers.google.com/games/services/android/quickstart#step_3_modify_your_code

Wichtig: Ich versuche ein Google Play Sign In (Google Game Services Sign In) einzurichten und kein Google Login

Links sind leider entfernt, da ich noch nicht die Erlaubnis habe, welche zu posten

Antworten
Timer
  • Forum-Beiträge: 9

10.01.2018, 21:29:47 via Website

Keystore Datei war defekt. Nach dem Neuerstellen der Datei geht nun alles

Antworten