User cancelled the dialog

Viewed 2556

I am getting this error (User cancelled the dialog) when I try the simple code as the example in the Ionic Framework.

this.health.isAvailable()
.then((available:boolean) => {
  console.log(available);
  this.health.requestAuthorization([
    'distance', 'nutrition',  //read and write permissions
    {
      read: ['steps'],       //read only permission
      write: ['height', 'weight']  //write only permission
    }
  ])
  .then(res => console.log(res))
  .catch(e => console.log(e));
})
.catch(e => console.log(e));
3 Answers

This problem is listed in the plugin's documentation with all the data needed.

But in case it gets lost in the sands of time, here's the excerpt.

It will try to get authorization from the Google fitness APIs. It is necessary that the app's package name and the signing key are registered in the Google API console. (see here).

Related