Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HEALTH 8.0.0 Quota Limit Exceeded #787

Open
Kam5678 opened this issue Aug 17, 2023 · 3 comments
Open

HEALTH 8.0.0 Quota Limit Exceeded #787

Kam5678 opened this issue Aug 17, 2023 · 3 comments
Labels
improvement an improvement

Comments

@Kam5678
Copy link

Kam5678 commented Aug 17, 2023

So currently I am running into the following issue for android whenever I try to fetch health data(Steps, HeartRate, Sleep_Session, Sleep_Awake)

E/AndroidRuntime(13306): android.os.RemoteException: Request rejected. Rate limited request quota has been exceeded. Please wait until quota has replenished before making further requests.
E/AndroidRuntime(13306): 	at androidx.health.platform.client.impl.error.ErrorStatusConverterKt.toException(ErrorStatusConverter.kt:49)
E/AndroidRuntime(13306): 	at androidx.health.platform.client.impl.ReadDataRangeCallback.onError(ReadDataRangeCallback.kt:35)
E/AndroidRuntime(13306): 	at androidx.health.platform.client.service.IReadDataRangeCallback$Stub.onTransact(IReadDataRangeCallback.java:75)
E/AndroidRuntime(13306): 	at android.os.Binder.execTransactInternal(Binder.java:1195)
E/AndroidRuntime(13306): 	at android.os.Binder.execTransact(Binder.java:1159)
E/AndroidRuntime(13306): 	Suppressed: kotlinx.coroutines.internal.DiagnosticCoroutineContextException: [StandaloneCoroutine{Cancelling}@a816b6d, Dispatchers.Main]

https://developer.android.com/guide/health-and-fitness/health-connect-guidelines/rate-limiting)
I honestly just wanted some guidance because I don't think this problem is related to the package, but more with the amount of API calls I can make when fetching data through healthconnect. But currently using this package I think all I can do is make these API calls to get data(Possible solution would be to minimize calls and save data to a database I think?)

https://developer.android.com/guide/health-and-fitness/health-connect/common-workflows/sync-data#pull-data
In order to minmize API calls android suggests using something called changelog handling which utilizes healthConnectClient and a function called getChangesToken(healthConnectClient.getChangesToken(..) to check if there were any changes in data, which I can then use to update my database data whenever there are changes. But I believe currently this health package doesn't support that?

Or honestly if there is any other possible solution you would suggest, since this issue right now causes my whole app to crash whenever I get this error.

Would honestly appreciate any guidance!

@Kam5678 Kam5678 added the improvement an improvement label Aug 17, 2023
@maxbeech
Copy link

Bumping this up. Definitely an issue, investigating support for changelog handling like Kam suggested would be hugely appreciated.

My use case: if I'm retrieving a lot of data, I have to do it in batches to avoid variables being too big, but this then triggers this error.

@AngryDuckFTW
Copy link

This is definitely a bit problem, my use case is steps and ive had to modify the source of the package in flutter cache to even find the error since it was just been consumed and returning an string just saying cant get steps! since this package only has an interface to pull steps from a from/to range and returning a total, if you want daily by hour thats 24 requests .. so you hit this limit almost instantly, and makes steps pretty much unusable

@Kam5678
Copy link
Author

Kam5678 commented Feb 14, 2024

Yeah, I was able to find a temporary solution for this. Basically what I did was I tried limiting the amount of API calls I made by only making API calls when needed. Each API call allowed 1000 entries in a list, so I would simply keep making these API calls until I recieved back a list that was of length < 1000. Meaning I recieved all needed data from start to end datetimes.

Then simply had to filter the list all at once to get individual date time data.

To go a step further you can then store this data to the database, and then make calls when needed from the last point in your database so that you don't have to make the same API calls everytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement an improvement
Projects
None yet
Development

No branches or pull requests

3 participants