Esempio n. 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.activity_fingerprintmanager_api);

            InitializeViewReferences();

            _fingerprintManager = FingerprintManagerCompat.From(this);
            string canScanMsg = CheckFingerprintEligibility();

            _startAuthenticationScanButton.Click += StartFingerprintScan;
            _scanAgainButton.Click       += ScanAgainButtonOnClick;
            _failedScanAgainButton.Click += RecheckEligibility;

            if (_canScan)
            {
                _dialogFrag = FingerprintManagerApiDialogFragment.NewInstance(_fingerprintManager);
            }
            else
            {
                Toast.MakeText(this, "No se puede utilizar escaneo de huella dactilar en el dispositivo. " + canScanMsg, ToastLength.Long).Show();
                OnBackPressed();
                return;
            }
            Permission permissionResult = ContextCompat.CheckSelfPermission(this,
                                                                            Manifest.Permission.UseFingerprint);

            if (permissionResult == Permission.Granted)
            {
                _initialPanel.Visibility        = ViewStates.Gone;
                _authenticatedPanel.Visibility  = ViewStates.Gone;
                _errorPanel.Visibility          = ViewStates.Gone;
                _scanInProgressPanel.Visibility = ViewStates.Visible;
                _dialogFrag.Init();
                _dialogFrag.Show(FragmentManager, DIALOG_FRAGMENT_TAG);
            }
            else
            {
                Snackbar.Make(FindViewById(Res.Id.Content),
                              Resource.String.missing_fingerprint_permissions,
                              Snackbar.LengthLong)
                .Show();
            }
        }
Esempio n. 2
0
 public override void OnAuthenticationFailed()
 {
     _fragment.Dismiss();
     Toast.MakeText(_fragment.Context, "Error al validar la huella dactilar, vuelva a intentar.", ToastLength.Short).Show();
     _fragment.Show(_fragment.FragmentManager, "fingerprint_auth_fragment");
 }