matinzd/react-native-health-connect

Empty exercise route

Opened this issue · 0 comments

Describe the bug
I'm trying to get the route of an exercise added via Google Fit (emulator with fake GPS and real device and real GPS), I've tested also with Samsung Health (same problem here), but it always returns an empty object. I don't know if it needs any extra configuration, but my permissions are as follows:

Permissions in code:

const grantedPermissions = await requestPermission([
    { accessType: "read", recordType: "ExerciseSession" },
    { accessType: "read", recordType: "Distance" },
    { accessType: "read", recordType: "ElevationGained" },
    { accessType: "read", recordType: "HeartRate" },
    { accessType: "read", recordType: "Power" },
    { accessType: "read", recordType: "Speed" },
    { accessType: "read", recordType: "Steps" },
    { accessType: "read", recordType: "TotalCaloriesBurned" },
    { accessType: "read", recordType: "CyclingPedalingCadence" },
]);

Android permissions (Expo app.json):

"permissions": [
        "android.permission.health.READ_EXERCISE_ROUTES",
        "android.permission.health.READ_EXERCISE",
        "android.permission.health.READ_DISTANCE",
        "android.permission.health.READ_ELEVATION_GAINED",
        "android.permission.health.READ_HEART_RATE",
        "android.permission.health.READ_POWER",
        "android.permission.health.READ_SPEED",
        "android.permission.health.READ_STEPS",
        "android.permission.health.READ_WORKOUTS",
        "android.permission.health.READ_TOTAL_CALORIES_BURNED"
],

I tested using both READ_EXERCISE_ROUTES and READ_EXERCISE_ROUTE.
No logcat errors.

To Reproduce
Steps to reproduce the behavior:

  1. Record a activity with GPS using Google Fit ou Samsung Health (emulator or real device)
  2. Read exercises
  3. Get exercise and check exerciseRoute object
  4. Object is empty

Expected behavior
Should return filled exercise route object.

Minimal Reproducible

// Empty here
const exerciseRecord = await readRecords("ExerciseSession", {
    timeRangeFilter: {
      operator: "between",
      startTime: "2024-07-09T12:00:00.405Z",
      endTime: "2024-08-20T23:53:15.405Z",
    },
});

// Empty here
const record = await readRecord(
      "ExerciseSession",
      exerciseRecord[0].metadata?.id as string,
);

Environment:
Health Connect Version: 2024.07.11.00.release
React Native Version: 0.74.3
New architecture enabled: No
Using Expo: Prebuild(Dev Client)