react-native-health-connect 2.0.3 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,6 +19,8 @@ This library is a wrapper around Health Connect for react native. Health Connect
19
19
 
20
20
  ## Requirements
21
21
 
22
+ Make sure you have React Native version 0.71 or higher installed to use v2 of React Native Health Connect.
23
+
22
24
  - [Health Connect](https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata&hl=en&gl=US) needs to be installed on the user's device. Starting from Android 14 (Upside Down Cake), Health Connect is part of the Android Framework. Read more [here](https://developer.android.com/health-and-fitness/guides/health-connect/develop/get-started#step-1).
23
25
  - Health Connect API requires `minSdkVersion=26` (Android Oreo / 8.0).
24
26
  - If you are planning to release your app on Google Play, you will need to submit a [declaration form](https://docs.google.com/forms/d/1LFjbq1MOCZySpP5eIVkoyzXTanpcGTYQH26lKcrQUJo/viewform?edit_requested=true). Approval can take up to 7 days.
@@ -29,10 +31,10 @@ This library is a wrapper around Health Connect for react native. Health Connect
29
31
  To install react-native-health-connect, use the following command:
30
32
 
31
33
  ```bash
32
- yarn add react-native-health-connect
34
+ npm install react-native-health-connect
33
35
  ```
34
36
 
35
- For version 2 onwards, please add the following code into your `MainActivity.kt` within the `onCreate` method:
37
+ If you are using React Native CLI template, for version 2 onwards, please add the following code into your `MainActivity.kt` within the `onCreate` method:
36
38
 
37
39
  ```diff
38
40
  package com.healthconnectexample
@@ -67,6 +69,7 @@ class MainActivity : ReactActivity() {
67
69
 
68
70
  ```
69
71
 
72
+ You also need to setup permissions in your `AndroidManifest.xml` file. For more information, check [here](https://matinzd.github.io/react-native-health-connect/docs/permissions).
70
73
 
71
74
  ## Expo installation
72
75
 
@@ -76,7 +79,7 @@ Just add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the
76
79
  First install the package with yarn, npm, or [`expo install`](https://docs.expo.io/workflow/expo-cli/#expo-install).
77
80
 
78
81
  ```sh
79
- expo install react-native-health-connect
82
+ npm install expo-health-connect expo-build-properties --save-dev
80
83
  ```
81
84
 
82
85
  Then add the prebuild [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:
@@ -84,7 +87,7 @@ Then add the prebuild [config plugin](https://docs.expo.io/guides/config-plugins
84
87
  ```json
85
88
  {
86
89
  "expo": {
87
- "plugins": ["react-native-health-connect"]
90
+ "plugins": ["expo-health-connect"]
88
91
  }
89
92
  }
90
93
  ```
@@ -1,8 +1,8 @@
1
1
  package dev.matinzd.healthconnect.permissions
2
2
 
3
+ import androidx.activity.ComponentActivity
3
4
  import androidx.activity.result.ActivityResultLauncher
4
5
  import androidx.health.connect.client.PermissionController
5
- import com.facebook.react.ReactActivity
6
6
  import kotlinx.coroutines.CoroutineScope
7
7
  import kotlinx.coroutines.Dispatchers
8
8
  import kotlinx.coroutines.cancel
@@ -15,7 +15,7 @@ object HealthConnectPermissionDelegate {
15
15
  private val coroutineScope = CoroutineScope(Dispatchers.IO)
16
16
 
17
17
  fun setPermissionDelegate(
18
- activity: ReactActivity,
18
+ activity: ComponentActivity,
19
19
  providerPackageName: String = "com.google.android.apps.healthdata"
20
20
  ) {
21
21
  val contract = PermissionController.createRequestPermissionResultContract(providerPackageName)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-health-connect",
3
- "version": "2.0.3",
3
+ "version": "2.1.0",
4
4
  "description": "React native library for health connect (Android only)",
5
5
  "funding": "https://github.com/matinzd/react-native-health-connect?sponsor=1",
6
6
  "main": "lib/commonjs/index",