Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Sharing my OAuth 2 framework with sample code

Download fitbit framework with sample code in below given link ,

https://www.dropbox.com/s/75o67w1o7nqvmay/FitbitRealTImeApplication.zip?dl=0

 

Moderator edit: Moved to its own topic

Best Answer
0 Votes
9 REPLIES 9

What language? What about GitHub?

Best Answer
0 Votes

Hi

I am trying to use your code but when I change Client Id and Client Secret, I'm getting error on webview 

"The app you're trying to connect did not provide valid information to Fitbit. Please report this issue to them.

Developer information: invalid_request - Invalid redirect_uri parameter value

"

 

Thanks

Best Answer
0 Votes

Did you register your redirect_uri in your app settings on https://dev.fitbit.com/apps ?

Best Answer
0 Votes

Yes, it's working now. The issue was with the Callback URL.

Best Answer
0 Votes

yes

Best Answer
0 Votes

Yes

Best Answer
0 Votes

Objective C

Best Answer
0 Votes

Thank you so much! This looks great.

 

I've been trying to switch over to Swift, so I had to refresh my ObjC. 

 

I'm having problems with intraday heart rate data. I modified your -pushToDashBoardClass function to run only the Heart Rate requests. My data came back unexpectedly and I am including my output. The lines with ++++ in them are my markers showing which function I called. I edited the returned data to keep this post to a reasonable length, but I never got any "activities-heart-intraday" data.

 

Perhaps you'd like to check your code, but I suspect this is not your problem since the calls you make appear to be correct. Is this a "Personal" app? If not, is there any way to distribute it as one?

 

Thanks.

 

2016-05-29 07:19:52.084 FitbitRealTImeApplication[48715:4305521] (null)
2016-05-29 07:20:18.507 FitbitRealTImeApplication[48715:4307120] [FITBITPlatform request] : [https://api.fitbit.com/1/user/-/profile.json] : 
{}
2016-05-29 07:20:18.637 FitbitRealTImeApplication[48715:4307120] [FITBITPlatform response] : [https://api.fitbit.com/1/user/-/profile.json] : 
{
    user =     {
        displayName = David;
    };
}

2016-05-29 07:20:18.640 FitbitRealTImeApplication[48715:4305521] Date string = 2016-05-29
2016-05-29 07:20:18.640 FitbitRealTImeApplication[48715:4305521] +++++  getFitbitHeartRateFromStartDate:endDate ++++ 
2016-05-29 07:20:18.641 FitbitRealTImeApplication[48715:4305521] [FITBITPlatform request] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-25/2016-05-29.json] : 
{}

2016-05-29 07:20:18.641 FitbitRealTImeApplication[48715:4305521] +++++  getFitbitHeartRateFromStartDate:endDate:detailLevel: ++++ 
2016-05-29 07:20:18.641 FitbitRealTImeApplication[48715:4305521] [FITBITPlatform request] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-25/2016-05-29/1sec.json] : 
{}

2016-05-29 07:20:18.641 FitbitRealTImeApplication[48715:4305521] +++++  getFitbitHeartRateOnDate:period: ++++ 
2016-05-29 07:20:18.642 FitbitRealTImeApplication[48715:4305521] [FITBITPlatform request] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-29/1d.json] : 
{}

2016-05-29 07:20:18.642 FitbitRealTImeApplication[48715:4305521] +++++  getFitbitHeartRateOnDate:period:detailLevel:++++ 
2016-05-29 07:20:18.642 FitbitRealTImeApplication[48715:4305521] [FITBITPlatform request] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-29/1d/1min.json] : 
{}

2016-05-29 07:20:18.752 FitbitRealTImeApplication[48715:4305570] [FITBITPlatform response] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-25/2016-05-29.json] : 
{
    "activities-heart" =     (
                {
            dateTime = "2016-05-25";
            dateTime = "2016-05-26";
            
            
            
            dateTime = "2016-05-29";
        }
    );
}
2016-05-29 07:20:18.754 FitbitRealTImeApplication[48715:4305570] {
    "activities-heart" =     (
                {
            dateTime = "2016-05-25";
            dateTime = "2016-05-26";
            
            
            dateTime = "2016-05-29";
        }
    );
}
2016-05-29 07:20:18.761 FitbitRealTImeApplication[48715:4305716] [FITBITPlatform response] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-29/1d/1min.json] : 
{
    "activities-heart" =     (
                {
            dateTime = "2016-05-29";
        }
    );
}
2016-05-29 07:20:18.761 FitbitRealTImeApplication[48715:4305716] {
    "activities-heart" =     (
                {
            dateTime = "2016-05-29";
        }
    );
}
2016-05-29 07:20:18.776 FitbitRealTImeApplication[48715:4305716] [FITBITPlatform response] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-29/1d.json] : 
{
    "activities-heart" =     (
                {
            dateTime = "2016-05-29";
            
        }
    );
}
2016-05-29 07:20:18.777 FitbitRealTImeApplication[48715:4305716] {
    "activities-heart" =     (
                {
            dateTime = "2016-05-29";
        }
    );
}
2016-05-29 07:20:18.794 FitbitRealTImeApplication[48715:4305570] [FITBITPlatform response] : [https://api.fitbit.com/1/user/-/activities/heart/date/2016-05-25/2016-05-29/1sec.json] : 
{
    categories =     (
                {
            activities =             (
                                {
                    accessLevel = PUBLIC;
                    activityLevels =                     (
                                                {
                            id = 3016;
                            maxSpeedMPH = "-1";
                            mets = "8.5";
                            minSpeedMPH = "-1";
                            name = "6 - 8 inch step";
                        },
                                                {
                            id = 3017;
                            maxSpeedMPH = "-1";
                            mets = 10;
                            minSpeedMPH = "-1";
                            name = "10 - 12 inch step";
                        }
                    );
                    hasSpeed = 0;
                    id = 90004;
                    name = "Aerobic step";
                },
                
               
                {
            activities =             (
                                {
                    accessLevel = PUBLIC;
                    hasSpeed = 0;
                    id = 52001;
                    mets = "4.300000190734863";
                    name = Yoga;
                },
                                {
                    accessLevel = PUBLIC;
                    hasSpeed = 0;
                    id = 52002;
                    mets = "5.900000095367432";
                    name = "Yoga, Bikram";
                },
                                {
                    accessLevel = PUBLIC;
                    hasSpeed = 0;
                    id = 52003;
                    mets = "2.299999952316284";
                    name = "Yoga, Hatha";
                },
                                {
                    accessLevel = PUBLIC;
                    hasSpeed = 0;
                    id = 52004;
                    mets = "4.300000190734863";
                    name = "Yoga, Power";
                },
                                {
                    accessLevel = PUBLIC;
                    hasSpeed = 0;
                    id = 52005;
                    mets = "7.300000190734863";
                    name = "Yoga, Vinyasa";
                }
            );
            id = 31;
            name = Yoga;
        }
    );
}
Best Answer
0 Votes

yes

Best Answer
0 Votes