diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d39c10..2c1bdf0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,6 +29,9 @@ jobs: - name: Typecheck files run: yarn typecheck + - name: Typecheck Expo example + run: yarn example:expo typecheck + test: runs-on: ubuntu-latest diff --git a/README.md b/README.md index bf95b84..64ecdff 100644 --- a/README.md +++ b/README.md @@ -208,6 +208,22 @@ your app needs: After updating `app.json`, run `npx expo prebuild` to regenerate the native Android project. +Health Connect is a native module, so it doesn't run in Expo Go. Use a +[development build](https://docs.expo.dev/develop/development-builds/introduction/): + +```sh +npx expo install expo-dev-client +npx expo prebuild --platform android +npx expo run:android +``` + +The library needs `minSdkVersion` 29. If your app targets lower, raise it with +[`expo-build-properties`](https://docs.expo.dev/versions/latest/sdk/build-properties/). + +For a working setup, see the **[Expo example app](example-expo/)** (Expo SDK 58, +dev client, config plugin). It checks availability, requests permission, reads +the last 7 days of steps and aggregates them. + ### Android setup (bare React Native) #### 1. Declare permissions in your app's `AndroidManifest.xml` diff --git a/docs/install.html b/docs/install.html index bd96986..6918ec4 100644 --- a/docs/install.html +++ b/docs/install.html @@ -95,6 +95,7 @@

On this page

Registries Version lines Requirements + Expo AI agent skill Alternatives @@ -182,8 +183,48 @@

03Requirements for 0.3.x

+
+

04Expo

+

+ Add the config plugin to app.json and list the permissions + your app uses. On prebuild it writes them, plus the Health Connect intent + filters, into AndroidManifest.xml. +

+
+
app.json
+
{
+  "expo": {
+    "plugins": [
+      "expo-dev-client",
+      ["expo-build-properties", { "android": { "minSdkVersion": 29 } }],
+      [
+        "@solutionforest/android-health-connect",
+        { "permissions": ["android.permission.health.READ_STEPS"] }
+      ]
+    ]
+  }
+}
+
+

+ Health Connect is a native module, so it does not run in Expo Go. Build a + development client instead: +

+
+
terminal
+
npx expo install expo-dev-client expo-build-properties
+npx expo prebuild --platform android
+npx expo run:android
+
+

+ The + Expo example app + (Expo SDK 58, React Native 0.88) shows the full flow: availability, + permission request, the last 7 days of steps, and an aggregate. +

+
+
-

04Install the AI agent skill

+

05Install the AI agent skill

The package includes skills.md, a skill file that tells coding agents how to use this library: which version line to pick, the @@ -230,7 +271,7 @@

04Install the AI agent skill

-

05Alternatives

+

06Alternatives