cordova-plugin-fingerprint-aio icon indicating copy to clipboard operation
cordova-plugin-fingerprint-aio copied to clipboard

Plugin pauses the application

Open mayankkataria opened this issue 3 years ago • 1 comments

I want this fingerprint dialog to popup when application resumes (when user press Home button and again reopens the app). But problem is that this plugin also pauses the application when it shows fingerprint dialog and application resumes again when authentication is successful. That's why the popup keeps on coming repeatedly even when authentication is successful because its getting triggered in platform.resume.subscribe() method. My code:

  initializeApp() {
    this.platform.ready().then(() => {
      this.platform.resume
      .subscribe(() => {
        // logic when the application has been resumed after being paused.
        // Show fingerprint dialog
        this.showFingerprint();
      });
      this.updateDarkMode();
      this.statusBar.styleDefault();
      this.splashScreen.hide();
    });
  }

  async showFingerprint() {
    try {
      await this.platform.ready();
      const available = await this.faio.isAvailable();
      this.toast = await this.toastController.create({
        message: 'available: ' + available,
        duration: 3000
      });
      await this.toast.present();
      if (this.platform.is('android') && available === 'biometric') {
        const result = await this.faio.show(this.foptions);
        if (result === 'biometric_success') {
          this.toast = await this.toastController.create({
            message: 'Authentication Successful',
            duration: 3000
          });
          await this.toast.present();
        }
    }
    } catch (error) {
      this.toast = await this.toastController.create({
        message: error.message,
        duration: 3000
      });
      await this.toast.present();
    }
  }

mayankkataria avatar Mar 24 '21 10:03 mayankkataria

Hi, I've the same issue on version 3.0.1 of the plugin. I don't know if it's fixed on new version 4.

Also it happens when using this plugin: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin It shares something, and put the app in "pause" and then it needs to go back and it calls the fingerprint plugin ("resume"). I need to know if it's a bad behaviour of the plugin or something wrong in my implementation.

Thanks.

cmgustavo avatar Jul 05 '21 16:07 cmgustavo