protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); fingerprintModule = new FingerprintModule(this); mKeyguardManager = fingerprintModule.ProvidesKeyguardManager (this); mKeyStore = fingerprintModule.ProvidesKeystore (); mKeyGenerator = fingerprintModule.ProvidesKeyGenerator (); mCipher = fingerprintModule.ProvidesCipher (mKeyStore); RequestPermissions (new [] { Manifest.Permission.UseFingerprint }, 0); }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Main); keyguardManager = (KeyguardManager)GetSystemService (Context.KeyguardService); var purchaseButton = FindViewById <Button> (Resource.Id.purchase_button); if (!keyguardManager.IsKeyguardSecure) { // Show a message that the user hasn't set up a lock screen. Toast.MakeText (this, "Secure lock screen isn't set up.\n" + "Go to 'Settings -> Security -> Screenlock' to set up a lock screen", ToastLength.Short).Show (); purchaseButton.Enabled = false; return; } CreateKey (); // Test to encrypt something. It might fail if the timeout expired (30s). purchaseButton.Click += (object sender, EventArgs e) => TryEncrypt (); }