private void DetectUser()
        {
            string appid = AGConnectServicesConfig.FromContext(Activity).GetString("client/app_id");

            SafetyDetect.GetClient(Activity).UserDetection(appid)
            .AddOnSuccessListener(new OnSuccessListener((Result) =>
            {
                UserDetectResponse userDetectResponse = (UserDetectResponse)Result;
                Log.Info("DetectUser", $"User detection succeed, response {userDetectResponse.ResponseToken}");
                Toast.MakeText(Activity.ApplicationContext, $"User detection succeed.", ToastLength.Short).Show();
            }))
            .AddOnFailureListener(new OnFailureListener((Result) =>
            {
                string errorMessage = null;
                if (Result is ApiException exception)
                {
                    errorMessage = $"{SafetyDetectStatusCodes.GetStatusCodeString(exception.StatusCode)}: {exception.Message}";
                }
                else
                {
                    errorMessage = ((Java.Lang.Exception)Result).Message;
                }
                Log.Error("DetectUser", errorMessage);
                Toast.MakeText(Activity.ApplicationContext, $"User detection failed! Message: {errorMessage}", ToastLength.Short).Show();
                // If value is 19800, this means Fake user detection failed. It also be throwed when user clicks cancel button.
            }));
        }
Beispiel #2
0
        public void OnSuccess(Java.Lang.Object p0)
        {
            UserDetectResponse response = (UserDetectResponse)p0;

            Log.Info("Result", "verify: Success result = " + response.ResponseToken.ToString());
        }