Comments (10)
@dariosalvi78 I forked the project and worked on some issues I was facing. All changes are backward compatible.
-
Added read or write only permissions in
requestAuthorization
for both iOS and Android.
See datatypes in https://github.com/aggarwalankush/cordova-plugin-health#requestauthorization. It now accepts an object specifying read or write only permissions. -
#35 This issue is closed but the solution isn't working. I standardized it like other plugins and added iOS keys strings as variables. See commit description on how to use it- aggarwalankush@0f8985e
-
I also added a
.editorconfig
file which I generally like in projects to maintain code formatting.
Full commits here - https://github.com/aggarwalankush/cordova-plugin-health/commits/master
Let me know if I should raise a PR.
from cordova-plugin-health.
Difference between read and write is not supported at the moment. On the to-do list.
Actually the health kit part is ready, the Google fit bit needs an update.
You're welcome to try to fix it.
from cordova-plugin-health.
@dariosalvi78 Thanks for the quick reply and your contributions. I am looking forward to using and contribute to this repo.
Can you tell me how to just ask for 'read' permissions in health kit? I can implement same in android and raise a PR soon. I'm focusing on this issue because 'isAuthorized' returns true only if user give both read and write permissions.
Also, in docs, you mentioned to always call 'requestAuthorization' before query method. I'm testing in iPhone and it's not helping at all. If I disable health kit permission from settings for my app, 'requestAuthorization' doesn't show popup to ask for health permissions again. Don't you think it's a bug?
from cordova-plugin-health.
Can you tell me how to just ask for 'read' permissions in health kit?
as for iOS, my plugin wraps Telerik's, so you could use that for asking read-only permissions
I can implement same in android and raise a PR soon.
that would be very welcome, it should be quite easy to achieve but requires a little change in the API too
you mentioned to always call 'requestAuthorization' before query method.
in iOS it doesn't make a big difference, but in Android it does, because the method also initialises the Google APIs
If I disable health kit permission from settings for my app, 'requestAuthorization' doesn't show popup to ask for health permissions again. Don't you think it's a bug?
It's how it works in HealthKit I'm afraid:
If the user has already chosen to grant or prohibit access to all of the types specified, the completion is called without prompting the user.
from cordova-plugin-health.
thanks, impressive work!
could you please submit a PR?
I'd love to merge it officially.
from cordova-plugin-health.
coolio,
I've tested it on Android and works like a charm!
from cordova-plugin-health.
@dariosalviwork I am facing one more issue in Android. I am using 'isAuthorized' and 'requestAuthorization' method and sometimes getting GoogleApiClient is not connected yet
. As both methods run in threads, that could be causing the issue. I don't know how to test Cordova plugins so couldn't figure out the cause. Maybe you could fix this issue someday or tell me how to build/test Cordova plugin.
from cordova-plugin-health.
testing the plugin is easy: create a sample cordova app, add the plugin, then open the Android project in Android studio by importing it from the "platforms" folder. That's it really.
I wonder how you managed to extend the plugin without testing it!
About your issue:
- be aware that the phone needs to be connected to the Internet, at least when requesting authorization the first time
- the thread shouldn't be a problem as all communication is asynchronous. Actually the use of threads is recommended by Cordova
- be sure you nest your calls and make sure you call, eg, a query() only AFTER your requestAuthorization() has called the successCallback
from cordova-plugin-health.
I have an ionic app, I tested using plugin in that app. I was wondering if there was an easy way. I'll see if I can figure out the issue sometime this weekend.
from cordova-plugin-health.
the easiest way is to forget Ionic and use a starter cordova app, then just open the console using chrome://inspect and run all the code from there
from cordova-plugin-health.
Related Issues (20)
- Google Oauth verification HOT 18
- How to pass the value to store blood_glucose? HOT 1
- Empty array for active calories HOT 2
- blood_glucose cannot be authorised on Android HOT 3
- How to query cycling distances in Health Connect? HOT 1
- add support for distance in Android HOT 6
- Add support for TotalCaloriesBurnedRecord HOT 1
- How obtain 3 synchronisations HOT 1
- delete operation on Android: Missing argument startDate HOT 3
- Datatype not supported heart_rate & Datatype not supported sleep HOT 6
- Open healthConnect / HealthKit programmatically to see app authorizations HOT 24
- AndroidManifest.xml permissions re-added when compiling HOT 3
- inconsistency in unit value for health data
- Android: Privacy Policy URL must be specified at installation time not runtime HOT 1
- Using targetSdkVersion 34 is not supported in Capacitor 5 HOT 4
- Execute multiple queries synchronously HOT 2
- NPM package is not updated HOT 3
- Health connect android - android 14 delete records crashes. HOT 1
- openHealthSettings() does not work on Android 14 / HONOR 70. HOT 6
- Always get steps in 0 count
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-health.