[HealthPlugin] Unable to authenticate / read data for Google Fit on Android

Forge Component
(3)
Published on 18 Jul by Sofia Mourato
3 votes
Published on 18 Jul by Sofia Mourato

Hi,


I tried the Healthplugin Demo and I also tried to implement the RequestHealthAuthorization in mz own app. Whenever I try to authorize Google Fit, the app opens a window which allows me to select a Google Account. After selecting my account, the Popup window closes but the the Authorization gives the Error message: "User cancelled the dialog". 


You say in the documentation that I need to "Configure a keystore and project on Google API Console", but I don't see where in the Forge Plugin I should fill in this data, except in the StoreData function, which I don't need, since I only want to read the Google Fit data.


Many thanks in advance for any support on this issue and many regards


Achim

Hi Achim,

The keystore will be used to generate the native Android app that you're building, to be installed in your device.

Kind regards,
Sofia

Sofia Mourato wrote:

Hi Achim,

The keystore will be used to generate the native Android app that you're building, to be installed in your device.

Kind regards,
Sofia


Hi Sofia,


thanks for your quick response. So I need to configure a keystore and a project and deploy the app to the Playstore to be able to try it out. It is not possible to test it by deploying it as Build type "Debug" in Service Studio?

Solution

Hey Achim,

You don't need to deploy to the Playstore.
You can still generate the app with the Debug type, but there you have also a "Configure Keystore" section (check image below).

Kind regards,
Sofia

Solution

Note for the people facing the sample problem:

If you haven't configured the APIs correctly, particularly the OAuth requirements, you are likely to get 'User cancelled the dialog' as an error message, particularly this can happen if you mismatch the signing certificate and SHA-1 fingerprint. ( https://github.com/dariosalvi78/cordova-plugin-health )


If you want to configure the API correctly please take a look into the Google Fit API guide path: https://developers.google.com/fit/android/get-started