public static async Task OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            if (requestCode == RC_SIGN_IN)
            {
                var result = await GoogleSignIn.GetSignedInAccountFromIntent(data).AsAsync <GoogleSignInAccount>();

                if (result != null)
                {
                    googleToken = result.IdToken;

                    var credential     = GoogleAuthProvider.GetCredential(result.IdToken, null);
                    var firebaseResult = await FirebaseAuth.Instance.SignInWithCredentialAsync(credential);

                    if (firebaseResult != null)
                    {
                        (CrossFirebaseEssentials.Authentication as FirebaseAuthenticationManager).SetVerificationStatus(VerificationStatus.Success);
                    }
                    else
                    {
                        (CrossFirebaseEssentials.Authentication as FirebaseAuthenticationManager).SetVerificationStatus(VerificationStatus.Failed);
                    }
                }
                else
                {
                    googleToken = string.Empty;
                    (CrossFirebaseEssentials.Authentication as FirebaseAuthenticationManager).SetVerificationStatus(VerificationStatus.Failed);
                }
            }
            else
            {
                callbackManager?.OnActivityResult(requestCode, (int)resultCode, data);
            }
        }
Пример #2
0
 public async Task HandleActivityResultAsync(int requestCode, Result resultCode, Intent data)
 {
     if (requestCode == RequestCodeSignIn)
     {
         await HandleSignInResultAsync(GoogleSignIn.GetSignedInAccountFromIntent(data));
     }
 }
Пример #3
0
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            if (requestCode == REQUEST_GOOGLE_FITNESS_AUTH)
            {
                authInProgress = false;
                HasGoogleFitnessAuthentication = resultCode == Result.Ok;
                System.Diagnostics.Debug.WriteLine($"Result after auth is: {HasGoogleFitnessAuthentication}");
                GoogleFitnessAuthenticationUpdated?.Invoke(HasGoogleFitnessAuthentication);
            }

            if (requestCode == REQUEST_GOOGLE_SIGN_IN)
            {
                googleLoginInProgress = false;
                var signInTask = GoogleSignIn.GetSignedInAccountFromIntent(data);
                if (signInTask.IsSuccessful)
                {
                    account = (GoogleSignInAccount)signInTask.Result;
                    RequestFitnessPermissions();
                }
            }

            if (requestCode == REQUEST_FITNESS_PERMISSIONS)
            {
                HasGoogleFitnessPermissions = resultCode == Result.Ok;
                GoogleFitnessPermissionsUpdated?.Invoke(HasGoogleFitnessPermissions);
            }
        }
Пример #4
0
 public static void ActivityResult(int requestCode, Result resultCode, Intent data)
 {
     if (requestCode == SIGNIN_RESP)
     {
         var task = GoogleSignIn.GetSignedInAccountFromIntent(data);
         _client.HandleSignIn(task);
     }
 }
Пример #5
0
        public static void OnAuthCompleted(int requestCode, Intent data)
        {
            if (requestCode != authActivityID)
            {
                return;
            }

            GoogleSignIn.GetSignedInAccountFromIntent(data).AddOnCompleteListener(CrossGoogleClient.Current as IOnCompleteListener);
        }
        public void OnActivetyResult(int requestCode, Result resultCode, Intent data)
        {
            if (requestCode == SignInRequestCode)
            {
                var task = GoogleSignIn.GetSignedInAccountFromIntent(data);

                if (task.IsSuccessful)
                {
                    var account = task.Result.JavaCast <GoogleSignInAccount>();
                    _tcs.TrySetResult(account.IdToken);
                }
                else
                {
                    _tcs.TrySetException(task.Exception);
                }
            }
        }
Пример #7
0
        public void OnActivityResult(int requestCode, Result resultCode, object data)
        {
            switch (requestCode)
            {
            case RequestCodeGoogleSignIn:
                if (resultCode == Result.Ok)
                {
                    GoogleSignIn
                    .GetSignedInAccountFromIntent(data as Intent)
                    .AddOnSuccessListener(this);
                }
                break;

            default:
                break;
            }
        }
Пример #8
0
 protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent data)
 {
     base.OnActivityResult(requestCode, resultCode, data);
     if (requestCode == SignCode)
     {
         try
         {
             Task authAccountTask = AccountAuthManager.ParseAuthResultFromIntent(data);
             if (authAccountTask.IsSuccessful)
             {
                 AuthAccount authAccount = (AuthAccount)authAccountTask.Result;
                 Log.Info(TAG, "Huawei ID login success. Access token: " + authAccount.AccessToken);
                 // Create Huawei Id credential
                 IAGConnectAuthCredential credential = HwIdAuthProvider.CredentialWithToken(authAccount.AccessToken);
                 // sign In
                 SignIn(credential);
             }
         }
         catch (Java.Lang.Exception ex)
         {
             Log.Error(TAG, "Failed: " + ex.Message);
         }
     }
     else if (requestCode == 64206)
     {
         callBackManager.OnActivityResult(requestCode, (int)resultCode, data);
     }
     else if (requestCode == 9001)
     {
         Android.Gms.Tasks.Task task = GoogleSignIn.GetSignedInAccountFromIntent(data);
         task.AddOnSuccessListener(new GoogleSignInListener(this));
         task.AddOnFailureListener(new GoogleSignInListener(this));
     }
     else if (requestCode == 9003)
     {
         Android.Gms.Tasks.Task task = GoogleSignIn.GetSignedInAccountFromIntent(data);
         task.AddOnSuccessListener(new GooglePlaySignInListener(this));
         task.AddOnFailureListener(new GooglePlaySignInListener(this));
     }
 }