Permissions, show dynamically button


#1

Hi,

I would like to show or hide a button (requestPermission) depending if the users grants permission for the speech recognition (ionic 3, angular core 6.0.0). But it do not work without any errors. Any ideas? Thank you so much.
Cheers Marco

 async hasPermission():Promise<boolean> {
    try {
      const permission = await this.speech.hasPermission();
      return permission;
      console.log(permission);
      this.requestPermission = false;
    } catch(e) {
      this.requestPermission = true;
      console.log(e);
    }
  }

  async getPermission():Promise<void> {
    try {
      this.requestPermission = false;
      this.speech.requestPermission();
    } catch(e) {
      this.requestPermission = true;
      console.log(e);
    }
  }