Open RonanMaguire opened 3 months ago
We are seeing the same problem. We have been using this library for some time now without any problems, without any changes on our part it seems that the step-count can no longer be retrieved.
At the same time, I see an increased occurrence of the following error: 5025: com.google.step_count.delta requires android.permission.ACTIVITY_RECOGNITION
, whereas it worked perfectly before (without any additional permission requests).
We are using react-native react-native 0.72.15
with react-native-google-fit 0.18.2
. The only scope we are using is
scopes: [Scopes.FITNESS_ACTIVITY_READ]. @RonanMaguire could you find out yet if the issue also occurs in the latest version too? I wonder if it might somehow be related to the future deprecation of google fit (#308)..
Well I guess this project is abandoned anyway and one should consider to moving to something like react-native-health-connect..
@c-goettert I seen that error you mentioned as well recently. I resolved it by adding <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
to my AndroidManifest.xml.
However, as you mentioned, it wasn't an issue before.
In doing this, I still wasn't able to see the distance, however, if you go into your apps 'info' there is an App permissions
option, where you can enable Physical Activity
. Enabling this allowed me to get the distance from GoogleFit and display it within my app again (however the steps still return empty). I'm not sure why this has changed.
When running the app locally - I did not have to enable the permissions mentioned above (it's possible this was enabled already for debug but I need to confirm this or why it's different debug vs release) steps however, remain empty.
I've yet to try the latest version to see if it makes any difference with the steps request. I may also try to see if getting individual steps works i.e. getDailySteps
Yes, moving to health-connect in the future is on my roadmap.
@RonanMaguire very interesting finds, thanks for sharing! If you find any way to access steps again please let us know 🙏
@c-goettert I've a working solution for this locally. I am able to create an array of dates from a startDate and endDate then map over these and call googleFit.getDailySteps(new Date(date))
for each date and then just create my own results array. Hope this helps.
const stepResults = await Promise.all(
dates.map(async (date) => {
const steps = await googleFit.getDailySteps(new Date(date));
const stepsDailyResults = steps.find(
(o) => o.source === 'com.google.android.gms:estimated_steps'
);
return stepsDailyResults.steps[0];
})
);
returns [{"date": "2024-07-01", "value": 1000}, {"date": "2024-07-02", "value": 1056}....]
@RonanMaguire thanks for letting me know. We were using getDailySteps
before. It seems to be working for us as well again after adding <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
to our manifest and actively requesting that permission from the user (using react-native-permissions).
Hi,
I've been using this library for a year now with great success. I use it to gather steps and distance data from a users GoogleFit app using the
getDailyDistanceSamples
andgetDailyStepCountSamples
methods.This month I have started to see issues with the response, mainly
getDailyDistanceSamples
, I have all the pre-reqs needed i.e. the Google OAuth creds and ask for (and allow) permissions locally i.e. allow MyApp to access steps and distance. But I've seen the steps request return an empty array. However, I was still getting the distance.The app is in the Play Store and now users aren't seeing the steps (mentioned above) and distance being displayed in MyApp. I need to have a look at what the distance request is returning locally but I assume it is similar to the steps issues.
Has there been any updates in Google or is anyone else experiencing this behaviour? Like I mentioned before, this was all working perfectly previously until the last month/mont and a half, where the responses are unpredictable i.e. they have the data or don't have the data.
Or any ideas as to why this would be happening? Has Google started to phase out certain features that were previously needed as they look to move toward the new health connect solution etc?
Using:
"react-native": "0.64.3", "react-native-google-fit": "^0.19.1"