Git Product home page Git Product logo

capacitor-healthkit's People

Contributors

alemf avatar aplekhanov avatar arnauddrain avatar crcht avatar fynnlyte avatar hrychg avatar jasonsultana avatar mahnuh avatar michaeljelly avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capacitor-healthkit's Issues

capacitor/core conflict with Ionic CLI 7

I am getting capacitor/core conflict with latest version of this plugin:

following is the error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @capacitor/[email protected]
npm ERR! node_modules/@capacitor/core
npm ERR! @capacitor/core@"5.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @capacitor/core@"^4.0.0" from @perfood/[email protected]
npm ERR! node_modules/@perfood/capacitor-healthkit
npm ERR! @perfood/capacitor-healthkit@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

my ionic env:

Ionic:

Ionic CLI : 7.1.1 (/Users/bhanu/.nvm/versions/node/v16.16.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 7.0.7
@angular-devkit/build-angular : 16.0.2
@angular-devkit/schematics : 16.0.2
@angular/cli : 16.0.2
@ionic/angular-toolkit : 9.0.0

Capacitor:

Capacitor CLI : 5.0.3
@capacitor/android : not installed
@capacitor/core : 5.0.3
@capacitor/ios : not installed

Utility:

cordova-res : not installed globally
native-run : 1.7.2

System:

NodeJS : v16.16.0 (/Users/bhanu/.nvm/versions/node/v16.16.0/bin/node)
npm : 9.6.5
OS : macOS Monterey

IOS Sleep Data - Not able to get REM, Core, Deep state values

While querying the IOS health Sleep data not able to fetch REM, Core, Deep sleep state values.I'm adding sample output when querying for sleep data,

[{"uuid":"2C360D2F-DA6B-4DDA-8A07-8D09B4CE0F39","timeZone":"+05:30","endDate":"2023-11-15T18:09:00Z","sleepState":"Asleep","startDate":"2023-11-15T06:01:00Z","source":"Health","duration":12.133333333333333,"sourceBundleId":"com.apple.Health","device":null},{"timeZone":"+05:30","uuid":"AD94453E-0CB4-4E45-A9BF-6D44DB0EAD65","duration":9,"sleepState":"InBed","source":"Health","endDate":"2023-11-16T02:00:00Z","device":null,"sourceBundleId":"com.apple.Health","startDate":"2023-11-15T17:00:00Z"},{"device":null,"source":"Health","timeZone":"+05:30","sleepState":"Asleep","uuid":"6B62AF8F-7689-41C0-A60E-6A9E5D83D414","duration":1,"startDate":"2023-11-15T18:08:00Z","endDate":"2023-11-15T19:08:00Z","sourceBundleId":"com.apple.Health"},{"sourceBundleId":"com.apple.Health","device":null,"duration":2,"startDate":"2023-11-15T19:11:00Z","sleepState":"Asleep","source":"Health","uuid":"E61337A6-3952-4262-83A6-CD2F6336F4A4","timeZone":"+05:30","endDate":"2023-11-15T21:11:00Z"},{"timeZone":"+05:30","sleepState":"Asleep","endDate":"2023-11-15T21:11:00Z","source":"Health","sourceBundleId":"com.apple.Health","startDate":"2023-11-15T20:11:00Z","device":null,"duration":1,"uuid":"06CFBD06-4966-4A81-8553-0DC6080D84F5"}]

[FEATURE] Support for HKObserverQuery

Hello! Thank you for your work on this plugin so far.

Are there plans to introduce an API that leverages HKObserverQuery so that we can subscribe to background events?

I have found this gist which seems to lay out how to enable background delivery for HKObjectTypes. Please forgive my ignorance if this example is not helpful as I am not familiar with Swift.

Thanks.

Incompatible with capacitor 5.xx

We are not able to install with the latest ionic (using capacitor 5.x)

Found: @capacitor/[email protected] node_modules/@capacitor/core
@capacitor/core@"5.1.1" from the root project
Could not resolve dependency: peer @capacitor/core@'^4.0.0"
from @perfood/[email protected]
node_modules/@perfood/capacitor-healthkit
@perfood/capacitor-healthkit@'*' from the root project

Getting error when calling `multipleQueryHKitSampleType`

querying multiple options.

Error: [Error] Error: Must provide startDate
CapacitorException — index.js:85
returnResult — user-script:2:768
(anonymous function) — user-script:2:750
if (Capacitor.getPlatform() == 'ios') {
      this.getIosData(new Date('07/10/2023').toISOString(), new Date('07/15/2023').toISOString());
}


async getIosData(startDate: string, endDate: string) {
    
    try {
      const queryOptions: MultipleQueryOptions = {
        sampleNames: [SampleNames.STEP_COUNT, SampleNames.WEIGHT],
        startDate: startDate,
        endDate: endDate,
        limit: 0,
      };

      console.log(queryOptions)

      let res = await CapacitorHealthkit.multipleQueryHKitSampleType(queryOptions);
      console.log(res);

    } catch (error) {
      console.error(error);
    }
  }

Updating the plugin to Capacitor 4.x?

Hey folks 👋

Thanks for your work on this plugin! I'd like to understand if you're having plans to actively maintain and further develop the plugin? If yes, do you see it feasible to support Capacitor 4.x?

Sleep data returns: {"errorDescription": "sampleTypeFailed"}

Hey! Thanks so much for making this, it's super cool!

I've run into a problem when trying to to get Sleep data from HealthKit. Instead of getting sleep data back I get this:

{
"errorDescription": "sampleTypeFailed"
}

I don't have much experience with Swift/iOS development, otherwise I'd make a PR request instead!

If there's anything I'm doing wrong as well, please let me know, I'm querying with the sample name: "sleepAnalysis", and as far as I understand, sleep falls under the "activity" Authorisation permission? Maybe Apple has changed this?

How to read carbohydrates, fat and proteins ?

Hi perfood,
thank you for your plugin,

I need to read from healthkit the quantities of carbohydrates, total fats and proteins from the dietary.

I notice that are not managed the keys: dietaryFatTotal, dietaryCarbohydrates, dietaryProtein.

How can I do to read other types of samples from the healthkit's api?

Thank you,
Leonardo

Error: Could not get permission on Capacitor 5.7.5 (iOS)

Hi there,

I'm having problems with requesting authorization and getting started with it.

I'm on capacitor 5.7.5 and when I installed this plugin using npm i --save @perfood/capacitor-healthkit I got a dependency error:
Could not resolve dependency: ERR! peer @capacitor/core@"^4.0.0" from @perfood/[email protected]

I then installed it via --legacy-peer-deps, but when I wanted to request authorization, I would get Error getting Authorization: Error: Could not get permission.

I reinstalled using the fork that Bin had made, but still no luck and may not be relevant to my Capacitor version.

const connectAppleHealth = async () => { 
    await requestPermissions();
  }

  const requestPermissions = async () => {
    const READ_PERMISSIONS = ['calories', 'activity', 'steps'];

    try {
      await CapacitorHealthkit.requestAuthorization({
        all: [''],
        read: READ_PERMISSIONS,
        write: [''],
      });

    } catch (error) {
      console.error('[HealthKitService] Error getting Authorization:', error);
    }
  }

And I'm testing on iOS 17.4.1

Your help is much appreciated!

Request authorization silent?

I am having a difficult time getting Apple HealthKit integration to work. Even though I have been following the documented basic example for requesting authorization (ie. CapacitorHealthkit.requestAuthorization), I have been unable to to trigger the confirmation screen to pop up.

Assuming I have followed the instructions as provided, is there some else I should be doing to enable Apple HealthKit integration in my app (any settings, etc)? Perhaps there is some build setting that needs to be enabled? Any suggestions as to what I should try to troubleshoot this issue?

Thanks!

No permission for Heart Reate

Hello! Thank you for the plugin.

I'm not seeing the permission for heart rate. I have added heartRate to the permission variable.

Am I missing something?

const readPermissions = ['calories', 'stairs', 'activity', 'steps', 'distance', 'duration', 'weight', 'heartRate'];

no heartrate

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.