Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin pauses the application #336

Open
mayankkataria opened this issue Mar 24, 2021 · 1 comment
Open

Plugin pauses the application #336

mayankkataria opened this issue Mar 24, 2021 · 1 comment
Labels

Comments

@mayankkataria
Copy link

mayankkataria commented Mar 24, 2021

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();
    }
  }
@cmgustavo
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants