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

no fcm token found #30

Open
angelbarrera92 opened this issue Mar 24, 2025 · 4 comments
Open

no fcm token found #30

angelbarrera92 opened this issue Mar 24, 2025 · 4 comments

Comments

@angelbarrera92
Copy link

Hi!

1st of all, thank you very much for this amazing project.

I'm trying to push some data via Rest API (with the hosted solution), and i am receiving this error:

{"error":"no fcm token found"}

The PUT request:

curl -X PUT -v "https://api.hcgateway.shuchir.dev/api/v2/push/steps" \
     --header "Authorization: Bearer MY_TOKEN_FROM_THE_POST_LOGIN" \
     --header "Content-Type: application/json" \
     --data '{
           "data": [
             {
               "startTime": "2025-03-23T10:00:00Z",
               "startZoneOffset": "+00:00",
               "endTime": "2025-03-23T10:30:00Z",
               "endZoneOffset": "+00:00",
               "count": 3000,
               "metadata": {
                 "source": "Hell0",
                 "device": "Friend"
               }
             }
           ]
         }'

Is the hosted solution still working?
My username is: overeager6549

@angelbarrera92
Copy link
Author

angelbarrera92 commented Mar 24, 2025

After log out, and log in in the android app,
now the REST API returns a different error:

{"error":"Message delivery failed"}

@angelbarrera92
Copy link
Author

How should I push data by Rest API?

@angelbarrera92
Copy link
Author

I attempted to self-host the solution and was able to troubleshoot the issue further.

After logging out and logging back in on the Android app, the REST API now returns a different error:

{"error":"Message delivery failed"}  

This is likely because the hosted solution (the default one) lacks the service-account.json file (from Firebase) in the api directory. If that’s the case, the hosted solution won’t work unless the developer addresses this issue.

Once I resolved this in my self-hosted fork, I encountered another issue—the request payload was incorrect.

Correct Payload Example

$ curl -X PUT -v "https://example.com/api/v2/push/steps" \
     --header "Authorization: Bearer A_VALID_TOKEN" \
     --header "Content-Type: application/json" \
     --data '{
           "data": [
             {
               "startTime": "2025-03-25T10:00:00Z",
               "startZoneOffset": "+00:00",
               "endTime": "2025-03-25T10:30:00Z",
               "endZoneOffset": "+00:00",
               "count": 3000,
               "metadata": {
                "recordingMethod": 0,
                "device": {
                  "manufacturer": "example.com",
                  "model": "gfit-b100",
                  "type": 0
                }
               }
             }
           ]
         }'

This format is based on the documentation:

With this corrected payload, I was able to see records in Google Fit using my own compiled APK.

Additional Notes

  • Removing Sentry integration: I attempted this but wasn’t able to do it.
  • Building on Mac M1: I ran into issues (likely my own mistake).
    • Building on Linux (Fedora latest): Everything worked smoothly.

Hope this helps clarify things! Let me know if you need more details.

@CoolCoderSJ
Copy link
Owner

thank you for taking a look at this! I thought I had mentioned the firebase file in the readme but it seems like I've overlooked it for the Docker method. Keeping this open until I update the documentation.

I'm also not sure how to standardize the payload- there's really no way to get a definitive data structure since it varies per data type (for example some types need a start and end time, while others just need a single time).

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

No branches or pull requests

2 participants